constantlearner
constantlearner

Reputation: 5247

spring xd with rabbit errorQueue as errorChannel

I have stream defined in my spring xd my stream looks something like this and transport is rabbit mq

stream source|transformer1|transformer2|transformer3|sink

I have custom transformers which I have deployed.I want to write all exception/error happening in my transformers/custom modules to a errorQueue I want to then pull the message in errorQueue to mongoSink

I can achieve this by creating tap from rabbiterror queue to mongo

`tap -->rabbit_ERROR_QUEUE-->mongoSink`

Is there any way I can configure my spring xd custom modules xml to write all exception and error to error queue by default?

Upvotes: 1

Views: 132

Answers (1)

Gary Russell
Gary Russell

Reputation: 174719

If you set autoBindDLQ to true (in servers.yml for all streams, or in the deployment properties at the stream level), XD will create a dead letter queue for you.

You also need to configure retry.

By default, the bus will try to deliver the message 3 times then reject it and the broker will forward it to the dead letter queue.

Another bus/deployment property republishToDLQ provides a mechanism for the bus to republish the message to the DLQ (instead of rejecting it). This will include additional information in the error message (exception exception etc) as headers.

See the application configuration section the deployment section of the reference manual for complete information about these properties.

However, you would not consume from the DLQ using a tap, but....

stream create errorStream --definition "rabbit ..."

i.e. use the rabbit source to pull from the DLQ.

Upvotes: 1

Related Questions