sstone / amqp-client

[THIS PROJECT HAS BEEN ARCHIVED AND IS NO LONGER MAINTAINED] Simple fault-tolerant AMQP client written in Scala and based on Akka and the RabbitMQ java client
MIT License
161 stars 88 forks source link

Feature request: possibility to create exclusive consumer #61

Closed randov closed 9 years ago

randov commented 9 years ago

We would like to use consumer in exclusive mode and although com.rabbitmq.client.Channel.basicConsume() allows it, would it be possible to add relevant support to Consumer actor (by adding relevant argument or even ConsumerParameters, where to bundle (autoAck, noLocal, exclusive) arguments?

Or is there any reason why it wouldn't be good idea?

Thanks!

sstone commented 9 years ago

Can you please have a look at branch wip-issue61 and tell me if that is what you are looking for ? Just out of curiosity, what is your use case ? (I've seen people use exclusive queues but not exclusive consumers yet) Thanks!

randov commented 9 years ago

Thank you, wip-issue61 seems to have the improvement I was looking for.

We are building data processing pipeline, where each step is coordinated by a cluster singleton actor (each of which distributes workload to workers across Akka cluster). Step coordinators are communicating with each other over RabbitMQ (persistent) queues. The motivation to use exclusive consumers is to have (additional) guarantee, that every step has only one coordinating actor running at a time (as theoretically there could be 2 cluster singleton running in case of cluster partitioning).

sstone commented 9 years ago

Ok. If wip-issue61 works for you then I'll merge with master and close the issue. I'll probably release a new version to maven central very soon. Thanks