Reputation: 5247
I have set up a spring xd stream with DLQ and I have made cyclic configuration to return from DLQ to main Queue.
xdbus.s3Test.0-->DLQ-->xdbus.s3Test.0
stream create s3Test --definition "aws-s3-source | log"
stream deploy S3test --properties module.*.consumer.autoBindDLQ=true
To make it a circle I had to change the configuration of DLQ adding this manually from rabbit mq ADMIN UI .
x-message-ttl: 30000
x-dead-letter-exchange: Default(Empty)
Is there any way in spring xd I can configure DLQ properties?Because DL queue will be generated by XD at run time and Ideally I cannot tamper this in production.Can i set some properties to set the above properties for DLQ?
Upvotes: 0
Views: 124
Reputation: 174719
You can't set the DLQ properties through XD, but you can create a policy in RabbitMQ that applies to DLQs created by XD:
$ rabbitmqctl set_policy XDDLQTTL "xdbus\..*\.dlq" '{"dead-letter-exchange":"", "message-ttl":30000}' --apply-to queues
This applies your required properties to all queues starting with xdbus.
and ending with .dlq
.
I just tested it with this and it works nicely...
xd:>stream create ticktock --definition "time --fixedDelay=60 | transform --expression=1/0 | log"
Created new stream 'ticktock'
xd:>stream deploy ticktock --properties module.*.consumer.autoBindDLQ=true
Deployed stream 'ticktock'
And you can see the message cycling (because of the divide by zero).
One caveat - this will keep trying forever; you would need some code in the module to look at the x-death
header if you wish to abort after some number of retries.
Upvotes: 2