0

I'm trying to send a simple message to a RabbitMQ (Version: 3.7.7) with AMQP 1.0 using the QPID JMS client. I'm using the following versions:

        <dependency>
            <groupId>org.apache.qpid</groupId>
            <artifactId>qpid-jms-client</artifactId>
            <version>0.40.0</version>
        </dependency>

        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>javax.jms-api</artifactId>
            <version>2.0</version>
        </dependency>

I enabled the rabbitmq_amqp1_0 plugin on the RabbitMQ and created a queue with the name "queue" on the broker with the help of the management UI. I then created a unit test with the following content:

public class JMSIssueTest {

    private static final String AMQP_URI = "amqp://localhost:5672";
    private static final String QUEUE_NAME = "queue";

    @Test
    public void testSend() throws Exception {
        JmsConnectionFactory factory = new JmsConnectionFactory(AMQP_URI);
        try(Connection connection = factory.createConnection()){
            connection.setExceptionListener(new MyExceptionListener());
            connection.start();
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Queue queue = session.createQueue(QUEUE_NAME);
            MessageProducer producer = session.createProducer(queue); // the code stops here
            TextMessage message = session.createTextMessage("test");
            producer.send(message);
            System.out.println("send");
        }
    }
    private static class MyExceptionListener implements ExceptionListener {
        @Override
        public void onException(JMSException exception) {
            System.out.println("Connection ExceptionListener fired, exiting.");
            exception.printStackTrace(System.out);
            System.exit(1);
        }

    }
}

If run this test I don't receive an error but in the console, I can see the following output:

 DEBUG org.apache.qpid.jms.provider.amqp.builders.AmqpProducerBuilder - Creating AmqpFixedProducer for: queue

On the RabbitMQ I can see the connection with the protocol type AMQP 1.0.

Am I creating the producer wrongly?

monti
  • 455
  • 7
  • 25
  • You'd need to turn on the protocol tracing as per the Qpid JMS documentation to see what happen during the create producer phase. – Tim Bish Jan 23 '19 at 14:44
  • I just found the queue on the rabbit to be durable. It works as soon as I create a none durable queue. – monti Jan 23 '19 at 15:37

0 Answers0