Hi everyone,
I’m looking for advice on the best way to schedule messages to be received after a certain time. I have a system where files get published out to a CDN and then the system needs to verify the files were propagated out correctly, this can sometimes take hours. I would like my subscriber to see a message, check for completion and if not put the message back on the queue to be dealt with in X minutes time.
Thanks for any help,
Darren
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
You could also stand up an instance of Apache Camel and have it manage
the process for you too. The DSL and spring xml methods are both very
easy to understand and configure.
Christian
There are two features which we are planning to implement in RabbitMQ
(please don't ask when ;) that in their combination can provide
delayed/scheduled message functionality: 1) per-queue message TTLs, and
2) dead-letter exchanges. The setup would look something like this:
The app creates a queue with the desired delay as the per-queue message
ttl. That queue is configured to route purged messages to an exchange
(using the dead-letter exchange feature). A second queue is bound to
that exchange to receive all the messages. The app consumes from the
second queue.
Regards,
Matthias.
Another solution, which you can implement right now, is to get the
publishers to stick an expiry header into the message and to publish the
message to a dedicated delay queue. A helper app consumes messages from
that queue one at a time and checks the expiry. If the expiry is in the
past it re-publishes the message to the appropriate exchange for
routing. Otherwise it waits until the deadline.
The expiries must be monotonically increasing per delay queue, though
you can setup several delay queues for different expiry intervals.
This (any many other) AMQP intermiediaries would be assisted by:
- A way to consume messages without receiving the message content, just
the properties and headers.
- A way to republish consumed messages without having to re-send the
message content to the server.
An with these features, implementing a general and efficient message
scheduler based on timer wheels would be fairly simple.
David
--
David Wragg
Staff Engineer, RabbitMQ
SpringSource, a division of VMware
By "intermediaries" (when I can spell it), I mean AMQP clients that
shuffle messages around, rather than publishing or consuming for their
own ends.
Interesting thought; like a basic.head (just the headers please) and
basic.redirect (please dequeue this and publish it again). The latter
could work with (unacked) messages acquired through basic.consume or
basic.get, too.
In the case of plugins, using a direct connection is effectively the
same thing, by the way.
mkb
No it's not. The msg may be fully on disk and not in RAM, at which point
you have to issue a disk read regardless of whether the client is
embedded or not.
Furthermore, we do not store the message headers separately from the msg
body. Thus the only thing you're saving by getting one, not the other,
is network transfer. And given the average message body size, ethernet
frame size and the fact that we turn nagel off, I'm not convinced in the
average case you'd actually save anything at all, but I could be missing
something.
Matthew
Well, it's not if the goal is to avoid unnecessary disk access. It is if
the goal is to avoid unnecessary TCP stack usage.
We'd get the network traffic saving immediately. And if worthwhile,
later on we could store message bodies separately, above a certain size
threshold. At the moment there is no motivation to consider doing that,
because AMQP always transmits the properties and body together.
And I doubt there is a meaningful notion of the average message body
size. Different AMQP applications have different characteristics.
--
David Wragg
Staff Engineer, RabbitMQ
SpringSource, a division of VMware