I would like to realize next scenario in Apache Camel (included in JBoss Fuse):
I have two systems, both of them produce events stored in database separately. Now I need to read events from this event tables and put them as messages in queue (realized by ActiveMQ). But what is really important I need to keep chronological order (creation time) of events in this queue, no matters where event was created.
I am looking for solution, which maximally uses components and patterns from Camel framework, of course I can realize the reading mechanism outside of Camel (pure Java), but I prefer Camel solution.
Thanks a lot for any idea!
I think you just want to pop the messages onto a seda
queue and use a resequencer
to merge them back into order.
from("--database1--")
to("seda:resequencer")
from("--database2--")
to("seda:resequencer")
from("seda:resequencer")
.resequence(header("date")).batch().timeout(5000L)
.to("activemq:...")
You will need to pay attention to the timeout settings and what is appropriate.
(Note: I haven't tested this code, so please tage it as a suggestion).