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:

        <route>
                <description>Slow producer simulation for Orders</description>
                <from
uri="activemq:topic:Tester/Orders?destination.consumer.retroactive=true"/>
                <log message="Delaying write of Order ${body} to Simulator 
topic"/>
                <delay><constant>2000</constant></delay>
                <to uri="activemq:topic:Tester/Orders/Simulator"/>
        </route>

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?

Thanks,
Bill



--
View this message in context: 
http://camel.465427.n5.nabble.com/Simulating-a-periodic-producer-tp5740783.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to