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

[Question] why Swarrot\Broker\Message::$id binds on delivery_tag ? #223

Open
rflavien opened this issue Nov 9, 2020 · 2 comments
Open

Comments

@rflavien
Copy link
Contributor

rflavien commented Nov 9, 2020

I can't use application's message identifier like this :

$publisher->publish(new Message("body", [], 34));
$message = $consumer->get();
$message->getId(); // 34

The Message identifier return the delivery_tag.

I can make a PR but I don't understand this behavior, so I'm asking first.

@stof
Copy link
Contributor

stof commented Nov 9, 2020

The message id is precisely meant to represent the id in the queuing system (used to ack or nack the message). AMQP does not let you control that id (at least as far as I know).

If you want to have an application identifier, store in the message body or in the message properties.

@rflavien
Copy link
Contributor Author

rflavien commented Nov 9, 2020

The message have a property section :
image

properties are :
image

And message id is defined :
image

Message-id, if set, uniquely identifies a message within the message system. The message
producer is usually responsible for setting the message-id in such a way that it is assured to be
globally unique. A broker MAY discard a message as a duplicate if the value of the message-id
matches that of a previously received message sent to the same node.

When I send a message trough Rabbit, the message identifier is well handled by PhpAmqpLib but it's not used by Swarrot (delivery_tag is used instead)
image
Here I publish with "38" in message_id properties

I agree that I can handle it in body or headers, I'm just trying to figure out what's the better way to do it.

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

No branches or pull requests

2 participants