Mark Trinh
Mark Trinh

Reputation: 442

How do I process message after RabbitTemplate return Timeout occurred?

I have a rabbit template configured for a synchronous return. It sends a message to a login queue that processes and returns a token. I'm currently setting the timeout to a certain value, which I usually don't expect it to occur. However, when it occurs, I would like to take that message and cleanup after it and logout.

Is there a way to catch that return when it occurs? I noticed this in the logs, saying it received a message after timeout.

WARN  [cTaskExecutor-1][core.RabbitTemplate#onMessage]: Reply received after timeout for 2689b5bd-4bd4-4470-a9a9-d84a1289d6ff

Upvotes: 0

Views: 645

Answers (1)

Gary Russell
Gary Russell

Reputation: 174739

There's currently no way to hook into that; it simply logs that warning.

It wouldn't be difficult at all for the template to reject the message so (if the reply queue is so configured) the late message could be sent to a dead-letter-exchange/queue in the broker.

Please open an Improvement JIRA Issue and we'll take a look at it.

Upvotes: 1

Related Questions