camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prgtrdr <>
Subject Simulating a periodic producer
Date Wed, 02 Oct 2013 20:18:17 GMT
I'm sure there must be an easy way to do this but I'm coming up blank.  Maybe
someone has an idea.  I'm trying to figure out how to restart a route once
it has exhausted all messages.

I'm trying to simulate an Orders stream that periodically sends prices to an
ActiveMQ topic.  I've created a bit of code to attach to the message broker
and write the messages.  For testing purposes I'd like to continuously
replay those messages whenever someone subscribes to the topic.  So after
some hunting, I found consumer.retroactive=true.

The problem is that ActiveMQ returns all the previous messages on the topic
immediately with no delay in between them, so my program shows pretty much
everything without the user being able to see anything happen on the screen. 
So I turned to Camel (of course).

I wrote a route that reads from the topic, delays 2 seconds, then writes to
a new topic, and changed the consumer program to read from the new topic. 
Looks like:

		<description>Slow producer simulation for Orders</description>
		<log message="Delaying write of Order ${body} to Simulator topic"/>
		<to uri="activemq:topic:Tester/Orders/Simulator"/>

So the only problem left now is, how do I get this route to restart once it
reads all messages on the topic (remember I want it to continuously repeat)? 
And can I do it from XML?


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message