0

I am attempting to run Apache QPID Broker (version 7.1.6) as an embedded, in memory broker and declare a queue on the broker with the queue declare option x-qpid-dlq-enabled set to "true".


public void createQueues() throws Exception {

    //connect to embedded broker running on local host
    ConnectionFactory factory = createConnectionFactory();
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();

    Map<String, Object> args = new HashMap<>();
    args.put("x-qpid-dlq-enabled",true);
    channel.queueDeclare("Test Queue", true, false, false, args);

According to entry for argument "x-qpid-dlq-enabled" found here: https://qpid.apache.org/releases/qpid-broker-j-7.1.0/book/Java-Broker-Appendix-Queue-Declare-Arguments.html

and according to behavior described in section 9.4.3 here: https://qpid.apache.org/releases/qpid-java-6.1.0/java-broker/book/Java-Broker-Runtime-Handling-Undeliverable-Messages.html

the expected behavior is that a a dead letter exchange and a dead letter queue are created automatically if that option is used. From the second link above:

"The DLQ feature causes generation of a Dead Letter Exchange and a Dead Letter Queue. These are named convention QueueName_DLE and QueueName_DLQ.

DLQs can be enabled when a new queue is created or using the queue declare property x-qpid-dlq-enabled."

However, I receive the following error when attempting to declare a queue using that declare argument.


    Exception in thread "main" java.io.IOException
        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:129)
        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:125)
        at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:147)
        at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:968)
        at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.queueDeclare(AutorecoveringChannel.java:333)
        at BrokerConnector.createQueues(BrokerConnector.java:43)
        at Main.main(Main.java:11)
    Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=404, reply-text=Unknown alternate exchange: 'Test Queue_DLQ', class-id=50, method-id=10)
        at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)

I am using RabbitMQ client to create an AMQPConnection to the QPID Broker and both client and broker are using AMQ protocol v 0_8. Why is the appropriate exchange not created automatically as specified in the QPID documentation, and why would the exchange name be suffixed with "_DLQ", instead of "_DLE", as also specified in the documentation. I understand that behavior is documented in Qpid for Java version 6, and I am running version 7.1.6, but no release notes from later documentation indicates that that behavior should be different, and version 7.1.6 documentation still indicates the "x-qpid-dlq-enable" argument is supported.

Any suggestions or ideas?

sjc
  • 1

1 Answers1

0

The way that you configure dead letter queues was changed in version 7.0 of Qpid Broker J. Unfortunately it looks like there was some code (and documentation) left over from the v6 mechanism, which is causing the error you are seeing.

From version 7 onwards you can set the DLQ (or more correctly the alternate binding) directly on the queue, without need for an alternate exchange.

The following mail exchange on the qpid-users@apache.org mailing list may prove useful if you want to make this happen automatically: http://qpid.2158936.n2.nabble.com/Qpid-Broker-J-configure-alternate-binding-in-Node-auto-creation-policy-tp7684426.html

Apologies for my earlier (and completely incorrect) guesswork here - I admit that part of the code is not something I look at often.

Rob Godfrey
  • 171
  • 1