Closed ahmetsevki closed 8 years ago
The message order isn't changed, they're being processed concurrently (per the execution context used by the subscription), so, race conditions et. al.
If you want them to be processed serially, then your options are:
If you use a same-thread execution context, be careful to not block on io, as that will result in your subscription blocking your actor system's thread pool.
I have a topic exchange that I am sending messages to. This is very similar to the example given on README. But instead I give message ids so I can track order of messages and I send back to back 5 messages via a loop.
val msgs = (1 to 5 ) map( i => Person(name = r, age = i ) )
msgs.foreach( msg => rabbitControl ! Message.topic( msg, exchange="z50.other-exchange", routingKey = "some-topic.very-interesting"))
On receiving side, I simply print them. I see that when I am subscribing if I pick
channel(qos = 3)
then the order of messages can change on receiving end. This doesn't happen if I set qos = 1