Enabling Replay mechanism with camel from messages from DB

痞子三分冷 提交于 2019-12-25 01:46:39

问题


Iam trying to implement replay mechanisam with camel ie., i will have to retrieve all the messages already persisted and forward to appropriate camel route to reprocess.This will be triggred by quartz scheduler.

I achieved the same by using below.

1) once the quartz scheduler is triggered, fwd to processor which will query db and have the message as list and set the same in camel exchange properties as list. 2) Use the camel in which LoopProcessor will set appropriate xml in the iteration in the exchange. 3) fwd it to activemq which will be forwarded to appropriate camel route to reprocess. Every thing is fine. I see the following TWO issues a) there might be 'n' number of msges(10,000+) which will be available in the camel exchange properties in the form of List - i can remove the message which is sent for processing but i think this will do more good on performance and memory usage.

b) I don want to forward all the 10,000+ messages to activemq which i guess will make it exhaustive. Is there a better mechanism to forward 10000+ messages to activemq. -- I am thinking to use SEDA/VM(using different camel contexts).how good this can give me considering above questions.

Thanks.

Regards Senthil Kumar Sekar


回答1:


If the number of messages is a problem, then not all messages should be loaded at once.

Process as follows (see also my answer for your other SO):

  1. Limit the number of results when querying the DB.
  2. Set a marker (e.g. processedFlag) for the DB entries that are processed
  3. Begin at 1. and query only the not already processed entries until all records are processed.

However, you should test the ActiveMQ approach as well, if 10,000+ messages are really a problem or not.



来源:https://stackoverflow.com/questions/22479005/enabling-replay-mechanism-with-camel-from-messages-from-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!