-
Notifications
You must be signed in to change notification settings - Fork 55
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
Key and partition selector #123
base: master
Are you sure you want to change the base?
Conversation
Ping @sroze |
Ping @Nyholm |
@@ -168,6 +170,16 @@ public function send(Envelope $envelope): Envelope | |||
$producer->setTimeToLive($this->options['timeToLive']); | |||
} | |||
|
|||
$partitionStamp = $envelope->last(PartitionStamp::class); | |||
if (method_exists($interopMessage, 'setPartition') && !is_null($partitionStamp)) { | |||
$interopMessage->setPartition($partitionStamp->getPartition()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What class do you expect here?
Ie, it is not Interop\Queue\Message
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Nyholm
I expect to have a Enqueue\RdKafka\RdKafkaMessage
I don't remember why I choose to check the method instead of checking the class...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nyholm do you prefer that?
$partitionStamp = $envelope->last(PartitionStamp::class);
if ($interopMessage instanceof RdKafkaMessage && !is_null($partitionStamp)) {
$interopMessage->setPartition($partitionStamp->getPartition());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add partition stamp for selecting the destination partition in Kafka.
Add key stamp for adding a key to kafka message
Those stamps can be added in a Messenger Middleware to choose the partition or add a key.
I didn't know the dependency versions to run the tests and i found that with this docker composer image the tests didn't throw any warning and are all ok
docker run --rm --interactive --tty --volume $PWD:/app composer:1.10.13 /bin/bash -c "composer install && vendor/bin/phpunit"
#53 (comment)