Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use x-dead-letter-exchange when deliver a delayed message #748

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

spuun
Copy link
Member

@spuun spuun commented Aug 8, 2024

WHAT is this pull request doing?

When an exchange is delayed it will create a queue and use message expiration and dead lettering for the delay. When a message is published to the exchange it will put the message in the "delay queue", and when the message is expired it will be republished to the message's exchange and the message is routed.

However, it's possible to publish messages to this queue via the default exchange and then the exchange field of the message is an empty string. This caused the message to be republished to the default exchange instead of the delayed exchange, resulting in the message looping between the queue and default exchange causing lavinmq to freeze.

This PR will make sure that the x-dead-letter-exchange argument for the queue is used when the messages is republished due to expiration.

HOW can this pull request be tested?

Run specs

Copy link
Member

@kickster97 kickster97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

@carlhoerberg
Copy link
Member

Shouldnt we prevent publishing directly to that internal queue instead? That the default exchange cant route to the queue?

@carlhoerberg
Copy link
Member

This will cause a performance hit as the headers have to be parsed for each message twice. Not critical for this exchange type, but we should be aware of it.

@spuun
Copy link
Member Author

spuun commented Aug 8, 2024

Yes, this is a "quick fix" and then we need to discuss how to limit internal queues.

@spuun
Copy link
Member Author

spuun commented Aug 8, 2024

Btw, which header parsing are you referring too? arguments?

@carlhoerberg
Copy link
Member

That's much better!

@spuun spuun merged commit 02cf23a into main Aug 12, 2024
20 of 25 checks passed
@spuun spuun deleted the bugfix-looping-message-in-delayed-exchange branch August 12, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants