Akka work pull multiple producers support

I am trying to explore work pull feature in the Akka cluster. Does the work pull feature supports registering multiple producers to the same service key? I tried the same by referring to the java example provided in the work pull and I am getting following warning in consumer and the message is discarded in consumer.

[2023-01-19 11:12:53,882] [WARN] [akka.actor.typed.delivery.ConsumerController] [] [ClusterSystem-akka.actor.default-dispatcher-3] - Received SequencedMessage seqNr [11], discarding message because it was from unexpected producer [Actor[akka://ClusterSystem@127.0.0.1:25253/user/producerController/c23a3d11-99e4-499c-ad23-753f7801f74e#-147912999]] when expecting [Actor[akka://ClusterSystem@127.0.0.1:25254/user/producerController/e04abc15-7cee-461f-b2d6-86d81d711dd3#-1160203197]].
[2023-01-19 11:12:54,885] [WARN] [akka.actor.typed.delivery.ConsumerController] [] [ClusterSystem-akka.actor.default-dispatcher-3] - Received SequencedMessage seqNr [12], discarding message because it was from unexpected producer [Actor[akka://ClusterSystem@127.0.0.1:25253/user/producerController/c23a3d11-99e4-499c-ad23-753f7801f74e#-147912999]] when expecting [Actor[akka://ClusterSystem@127.0.0.1:25254/user/producerController/e04abc15-7cee-461f-b2d6-86d81d711dd3#-1160203197]].
[2023-01-19 11:12:55,884] [WARN] [akka.actor.typed.delivery.ConsumerController] [] [ClusterSystem-akka.actor.default-dispatcher-3] - Received SequencedMessage seqNr [13], discarding message because it was from unexpected producer [Actor[akka://ClusterSystem@127.0.0.1:25253/user/producerController/c23a3d11-99e4-499c-ad23-753f7801f74e#-147912999]] when expecting [Actor[akka://ClusterSystem@127.0.0.1:25254/user/producerController/e04abc15-7cee-461f-b2d6-86d81d711dd3#-1160203197]].
[2023-01-19 11:12:56,903] [WARN] [akka.actor.typed.delivery.ConsumerController] [] [ClusterSystem-akka.actor.default-dispatcher-7] - Received SequencedMessage seqNr [14], discarding message because it was from unexpected producer [Actor[akka://ClusterSystem@127.0.0.1:25253/user/producerController/c23a3d11-99e4-499c-ad23-753f7801f74e#-147912999]] when expecting [Actor[akka://ClusterSystem@127.0.0.1:25254/user/producerController/e04abc15-7cee-461f-b2d6-86d81d711dd3#-1160203197]].

Does Akka’s work pull support, multiple producers? or is there any other solution in Akka where multiple workers/consumers can pick jobs from a single service/queue which is populated by multiple producers?

No, that is not supported, only one producer with many consumers registering themselves through the service key.

The producer can implement arbitrary logic to produce though, so it is possible to make a single producer represent multiple underlying queues (or other actors). Exactly how depends on use case.

1 Like

Hi johan, Thanks for your reply. Is there any solution provided by Akka in which multiple workers can pull work from multiple producers through a single queue/service? Can I achieve this using Akka Streams or Alpakka Kafka.?

Yes, multiple producers is doable with Akka Streams (“fan in”) or Alpakka Kafka where any number of producers could produce to a single Kafka topic.

1 Like