Cant get shrading to work
vpaskovic opened this issue · 3 comments
I am having issue using sharding. I want to achieve having one queue that has 6 consumers but with sharding to achieve that each consumer is on one CPU.
After enabling
rabbitmq-plugins enable rabbitmq_sharding
and setting up config
'exchange' => 'shard.videos',
'exchange_type' => 'x-modulus-hash',
making policy
rabbitmqctl set_policy videos-shard "^shard.videos$" "{""shards-per-node"": 1,""routing-key"": ""fc_analyze""}"
with
\Amqp::publish('fc_analyze', 'this is message');
I get it to wright queue but can not get consumer in that queue using this code
\Amqp::consume('videos', function ($message, $resolver) {
var_dump($message->body);
sleep(20);
$resolver->acknowledge($message);
}, [
'message_limit' => 1,
'exchange' => 'shard.videos',
'exchange_type' => 'x-modulus-hash',
'routing_key' => 'fc-analyze',
]
);
Please help and advice.
Thank you
@vpaskovic The queue name is 'shard.videos' right? But you got 'videos' and 'shard.videos' mixed.
Just reopen this issue if it's still not working.
Hi @stevenklar when I put 'shard.videos' in \Amqp::consume('shard.videos', there is Error, as it does not accept queue name with dots.
So there is still a problem.
Right now I'm not sure if we support this. Must be tested.
/Reopen