Confirmation on message ordering sequence

212 views
Skip to first unread message

springusr

unread,
Mar 9, 2017, 6:02:31 PM3/9/17
to rabbitmq-users
If we send messages like below using rabbit template, I believe its not guaranteed to deliver in order they sent (because it might not use same channel), please confirm.

 for (int i = 1; i <= 25; i++) {
 rabbitTemplate
.convertAndSend("testQ", message);
 
}

Michael Klishin

unread,
Mar 9, 2017, 6:05:14 PM3/9/17
to rabbitm...@googlegroups.com, springusr
RabbitMQ will sent confirmations [1] in the same order but can acknowledge multiple messages
at once. I can't comment on Spring AMQP. Spring AMQP folks take questions on Stack Overflow labelled
with "spring-amqp."

1. https://www.rabbitmq.com/confirms.html 
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Gary Russell

unread,
Mar 9, 2017, 6:20:35 PM3/9/17
to rabbitm...@googlegroups.com, springusr
Yes, channels are cached between template operations and there is no guarantee that the same channel will be used in that scenario.

The upcoming 2.0 release of Spring AMQP has a new mechanism to perform multiple tasks on the same channel [1].

For example:

Collection<?> messages = getMessagesToSend();
Boolean result = this.template.invoke(t -> {
    messages.forEach(m -> t.convertAndSend(ROUTE, m));
    t.waitForConfirmsOrDie(10_000);
    return true;
});

It is guaranteed that the same channel is used in that case.

This will be available in the next milestone in a couple of weeks (it's in the BUILD-SNAPSHOT now).

With earlier releases you would have to use template.execute() with a ChannelCallback and use channel.basicPublish() calls within the scope of the callback.



On Thu, Mar 9, 2017 at 6:05 PM, Michael Klishin <mkli...@pivotal.io> wrote:
RabbitMQ will sent confirmations [1] in the same order but can acknowledge multiple messages
at once. I can't comment on Spring AMQP. Spring AMQP folks take questions on Stack Overflow labelled
with "spring-amqp."

1. https://www.rabbitmq.com/confirms.html 

On 10 March 2017 at 02:02:34, springusr (patelm...@gmail.com) wrote:
> If we send messages like below using rabbit template, I believe its not
> guaranteed to deliver in order they sent (because it might not use same
> channel), please confirm.
>
> for (int i = 1; i <= 25; i++) {
> rabbitTemplate.convertAndSend("testQ", message);
> }
>
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
> To post to this group, send an email to rabbitmq-users@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send an email to rabbitmq-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages