user2820299
user2820299

Reputation: 57

Camel route to Websphere MQ , read interval

I use camel route in ActiveMQ in order to read message from websphere MQ queue and to forward the messages into a activeMQ queue, it works fine but it seems that the wmq read action is too often (every 1 secs). How to define a read interval value ? for example read messages every 10 secs ?

Tks a lot Nicolas

Upvotes: 3

Views: 1406

Answers (2)

MGolovanov
MGolovanov

Reputation: 65

It seems a wrong way to change jms component settings for changing read queue interval.

Spring JMS that used as underlying technology for Camel jms component are designed to polling queue often. Changing polling interval for jms endpoints need a deep understanding internals of Spring JMS. My experiments with this approach do not get any positive results.

Another way satisfies your requirements is a polling consumer. The idea is periodically run queue reading operation with timer (or another scheduler like quartz).

from("timer://foo?period=5000").bean("queueReader")

queueReader bean should implements queue reading operation.

But this approach have some pifalls. One of them is how to handle situation when queue have more than one messsage. This requires to loop queue reading, but new messages can arrive when existing ones worked on. This sitation need low level and error prone coding.

You would read details about polling consumer in Camel here

Upvotes: -1

hemant1900
hemant1900

Reputation: 1226

You need to change the receiveTimeout and requestTimeoutCheckerInterval of JmsComponent which is used for MQ endpoints. By default these values are 1 sec.

Refer: - http://camel.apache.org/jms.html

Upvotes: 1

Related Questions