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

Publish to exchange #786

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Publish to exchange #786

wants to merge 1 commit into from

Conversation

snichme
Copy link
Member

@snichme snichme commented Sep 18, 2024

WHAT is this pull request doing?

Move the logic of publishing a message to an exchange from Vhost to the exchange.

The idea came because of the need for the exchange to handle the messages differently for MQTT support
but it has additional benefits like @queue_bindings and @exchange_bindings can have different types and as you may see I've used only one "bindings" for both queue and exchange. for example for FanoutExchange it's just a @bindings : Set(Destination)

There is probably some more things that should move down to each subclass to make the code clearer and to support the different types that @bindings has now.

HOW can this pull request be tested?

specs

spec/tx_spec.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/default.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/default.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/default.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/direct.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/headers.cr Show resolved Hide resolved
This was referenced Sep 25, 2024
src/lavinmq/exchange/exchange.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/exchange.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/exchange.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/topic.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/topic.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/topic.cr Outdated Show resolved Hide resolved
@snichme
Copy link
Member Author

snichme commented Sep 27, 2024

@spuun @carlhoerberg any thoughts about always including "default" exchange when getting bindings for a queue heere: https://github.com/cloudamqp/lavinmq/blob/publish-to-exchange/src/lavinmq/vhost.cr#L286
instead of adding the default in the http controllers

@carlhoerberg
Copy link
Member

Im fine with that

@snichme snichme marked this pull request as ready for review September 27, 2024 14:54
Copy link
Member

@spuun spuun left a comment

Choose a reason for hiding this comment

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

I ran out of stamina to suggest a few other early returns... I'm not gonna fight for early returns, but i think it's nice.

src/lavinmq/exchange/consistent_hash.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/consistent_hash.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/consistent_hash.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/default.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/default.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/headers.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/headers.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/headers.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/headers.cr Outdated Show resolved Hide resolved
src/lavinmq/exchange/topic.cr Outdated Show resolved Hide resolved
@snichme
Copy link
Member Author

snichme commented Sep 30, 2024

@spuun agree, early return is nicer. Fixed all now I thinkg

src/lavinmq/exchange.cr Outdated Show resolved Hide resolved
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