Yash
Yash

Reputation: 1018

How to transfer messages, each at a specific time?

I have about 10K messages in a CSV file. Each message has an associated timestamp for it. When the time is reached, I want the message delivered to an MQ. The timestamps are not uniformly spread. Is this possible with Apache Camel?

Upvotes: 0

Views: 50

Answers (1)

Pasi Österman
Pasi Österman

Reputation: 2197

As far as I know Apache Camel by default has no consumer endpoint components that you could configure to trigger with specific messages at specified times.

There is however a timer component that you can setup to trigger for example once a second. Then in the route you could use a processor to check if a list contains any messages that should be send at the given time and send them to the MQ.

You could also trigger route from java code using a ProducerTemplate that you can create using the CamelContext.

The list could be populated using your csv file and ordered by timestamp so you could use it like a stack and only check the first few entries instead of going through all 10K every second.

The real problem here would be persistence i.e to figure out which of the messages listed on the csv have already been sent if the application closes before all 10K messages have been sent.

Upvotes: 1

Related Questions