camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Pavlovich <mattr...@gmail.com>
Subject Re: Reading all messages from ActiveMQ in pre defined interval
Date Tue, 14 Feb 2012 15:58:07 GMT
I think you should consider reading from the queue directly, and remove 
the timing piece from the design altogether.  The beauty in this 
approach, is that it will be processing closer to realtime, and it will 
aggregate only when you need to aggregate.. in 3s batches.  If you only 
get one message every 5 minutes, there won't be any aggregating at all, 
but if you get a burst, then you will throttle traffic into the 
bean:monitorEvaluator by aggregating in 3s chunks.  You probably want to 
add a completionSize argument, so you'll cap your aggregation in terms 
of message count, as well as time.

<from uri="jms:queue:monitoring"/>
<aggregate ...>
     ..
<to uri="bean:monitorEvaluator"/>
</aggregate>

On 2/14/12 9:43 AM, weggyboy wrote:
> Hello,
>
> I am trying to implement a camel solution for a pretty simple requirement.
> Its about a monitoring system with jms. Here is what it looks like:
>
> 1. a process writes jms messages with an xml body in an activemq queue. The
> xml body contains the monitoring data to be evaluated.
> 2. in a pre defined interval i wish to read ALL messages from that queue and
> pass all the content to a bean processor.
> 3. the bean processor evaluates all the messages content and sends an e-mail
> report to a pre defined mail address.
>
> All my camel routes are being defined as xml. I prefer not to write any java
> code but the bean processor.
> Using a timer with pollEnrich of type jmsConsumer together with aggregator
> did not work properly. Only one message could be read at time instead of
> all.
>
> <route>
>      <from uri="timer://monitoringTimer&amp;period=600000" />
>      <pollEnrich uri="jms:queue:monitoring"/>
>      <aggregate strategyRef="aggregatorStrategy" completionTimeout="3000">
>          <correlationExpression>
>              <constant>true</contant>
>          </correlationExpression>
>          <to uri="bean:monitorEvaluator"/>
>      </aggregate>
> </route>
>
> I was wondering if someone could give me some ideas on how to realize it
> with camel.
> Perhaps someone has any other better approach to solve this.
> I would be very thankful ;)
>
> Cheers,
>
> Wagner
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Reading-all-messages-from-ActiveMQ-in-pre-defined-interval-tp5482810p5482810.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message