Hi Timo,
Surprisingly, you can "auto-create" both your main queue and dead letter queue
using auto-creation policies.
For instance, for your main queues you can create policy matching regular
expression like so "^.*(?<!_DLQ)$" (any queue name not ending with _DLQ) and
for dead letter queues you can create policy matching regular expression
".*_DLQ".
In main queue policy attributes you need to specify attribute
"alternateBinding".
The trick here is to derive the dead letter queue name from your original queue
name.
For example, if queue name is "foo", the dead letter queue name should be
"foo_DLQ".
Setting alternateBinding to {"destination": "${this:name}_DLQ"} would do the
trick. However, on policy saving the expression is interpolated into virtual
host name. As result, all queues created with such policy would point to the
same DLQ queue with name starting with virtual host name and ending with suffix
"_DLQ".
There is a trick you can use to prevent the interpolation of dead letter queue
name on policy saving. You can introduce a global context variable "dollar"
set to value "$" on broker or virtual host level, and use the following
expression for the dead letter queue name "${dollar}{this:name}_DLQ". The
latter on policy saving would be interpolated into "${this:name}_DLQ" and would
result in DLQ queue creation with name derived from the original queue.
Here is a working example of such policies
"nodeAutoCreationPolicies" : [ {
"pattern" : "^.*(?<!_DLQ)$",
"nodeType" : "Queue",
"attributes" : {
"alternateBinding" : "{\"destination\": \"${dollar}{this:name}_DLQ\"}",
"maximumDeliveryAttempts" : "2"
},
"createdOnPublish" : true,
"createdOnConsume" : true
}, {
"pattern" : ".*_DLQ",
"nodeType" : "Queue",
"attributes" : { },
"createdOnPublish" : true,
"createdOnConsume" : true
} ]
Please do not forget to add a context variable "dollar=$". Otherwise, the above
would not work.
Kind Regards,
Alex
On 2019/06/11 00:24:15, tnaroska <[email protected]> wrote:
> Hi,
>
> I'm trying to set up qpid broker-J so that each of my queues gets a
> DLQ/alternate Binding. I'm using an auto create policy to have queues
> dynamically created on first use by a JMS client.
>
> Unfortunately I haven't found a way to accomplish this. Ideally I'm looking
> for something similar to the deadLetterStrategy in ActiveMQ, where I can
> configure a prefix in one global setting that gets used to set up and name
> DLQs.
>
> As described
> here:http://activemq.apache.org/message-redelivery-and-dlq-handling
>
> Is there anything similar in QPid? What would be the alternative? Use AMQP
> management calls from the client to create my queues and setup
> alternateBindings?
>
> Thanks
> Timo
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]