Here is the route that I configured + aggregator

            <camel:from
uri="quartz://x3sReporting/clientError?cron=0+0/5+9-18+?+*+MON-FRI"/>
            <camel:pollEnrich uri="queuingservice:x3s:reporting"
strategyRef="queueAggregator"/>

            <camel:transacted ref="PROPAGATION_REQUIRED_NEW" />
            <camel:choice>
                <camel:when>
                    <camel:simple>${body} != null</camel:simple>
                    <camel:doTry>
                        <camel:marshal ref="csvAuditBindyDataFormat" />

public class QueueAggregator implements AggregationStrategy {

    private static final transient Log LOG =
LogFactory.getLog(QueueAggregator.class);

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        if (newExchange == null) {
            LOG.info("Old object received (null exchange) : " +
oldExchange.getIn().getBody().toString());
            return oldExchange;
        }
        Object oldBody = oldExchange.getIn().getBody();
        LOG.info("Old object received : " + oldBody.toString());
        Object newBody = newExchange.getIn().getBody();
        LOG.info("New object received : " + newBody.toString());
        oldExchange.getIn().setBody(newBody);
        return oldExchange;
    }
}

Unfortunately, the aggregator is not called (no info trace in the LOG) and
the body object send to the endpoint (marshall) is of type
org.quartz.JobDetail

11:10:02,703 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger   88 |
ID-dell-charles-3372-1251127950838-0-10 >>>
from(quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI) -->
ref:PROPAGATION_REQUIRED_NEW, Pattern:InOnly,
Headers:{triggerGroup=x3sReporting,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009, previousFireTime=null,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false,
triggerName=clientError, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
scheduler=org.quartz.impl.stdschedu...@16975d, jobRunTime=-1,
scheduledFireTime=Tue Aug 25 11:10:00 CEST 2009, result=null, calendar=null,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc, refireCount=0, fireTime=Tue
Aug 25 11:10:00 CEST 2009}, BodyType:org.quartz.JobDetail, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
11:10:02,718 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger   88 |
ID-dell-charles-3372-1251127950838-0-10 >>> ref:PROPAGATION_REQUIRED_NEW -->
Choice, Pattern:InOnly, Headers:{triggerGroup=x3sReporting,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009, previousFireTime=null,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false,
triggerName=clientError, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
scheduler=org.quartz.impl.stdschedu...@16975d, jobRunTime=-1,
scheduledFireTime=Tue Aug 25 11:10:00 CEST 2009, result=null, calendar=null,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc, refireCount=0, fireTime=Tue
Aug 25 11:10:00 CEST 2009}, BodyType:org.quartz.JobDetail, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
11:10:02,734 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger   88 |
ID-dell-charles-3372-1251127950838-0-10 >>> Choice --> Try, Pattern:InOnly,
Headers:{triggerGroup=x3sReporting,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009, previousFireTime=null,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false,
triggerName=clientError, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
scheduler=org.quartz.impl.stdschedu...@16975d, jobRunTime=-1,
scheduledFireTime=Tue Aug 25 11:10:00 CEST 2009, result=null, calendar=null,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc, refireCount=0, fireTime=Tue
Aug 25 11:10:00 CEST 2009}, BodyType:org.quartz.JobDetail, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
11:10:02,734 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger   88 |
ID-dell-charles-3372-1251127950838-0-10 >>> Try -->, Pattern:InOnly,
Headers:{triggerGroup=x3sReporting,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009, previousFireTime=null,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false,
triggerName=clientError, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
scheduler=org.quartz.impl.stdschedu...@16975d, jobRunTime=-1,
scheduledFireTime=Tue Aug 25 11:10:00 CEST 2009, result=null, calendar=null,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc, refireCount=0, fireTime=Tue
Aug 25 11:10:00 CEST 2009}, BodyType:org.quartz.JobDetail, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
11:10:03,171 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger  166 |
ID-dell-charles-3372-1251127950838-0-10 >>> Try -->, Pattern:InOnly,
Headers:{triggerGroup=x3sReporting,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009, previousFireTime=null,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false,
triggerName=clientError, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
scheduler=org.quartz.impl.stdschedu...@16975d, jobRunTime=-1,
scheduledFireTime=Tue Aug 25 11:10:00 CEST 2009, result=null, calendar=null,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc, refireCount=0, fireTime=Tue
Aug 25 11:10:00 CEST 2009}, BodyType:org.quartz.JobDetail, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false, Exception:
java.lang.ClassCastException: org.quartz.JobDetail
11:10:03,171 | INFO  | heduler_Worker-1 | TraceInterceptor                 |
rg.apache.camel.processor.Logger   88 |
ID-dell-charles-3372-1251127950838-0-11 >>>  -->
log://com.xpectis.x3s?level=INFO&multiline=true&showCaughtException=true&showException=true&showStackTrace=true,
Pattern:InOnly, Headers:{calendar=null, scheduledFireTime=Tue Aug 25
11:10:00 CEST 2009, trigger=Trigger 'x3sReporting.clientError':
triggerClass: 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
misfireInstruction: 0 nextFireTime: Tue Aug 25 11:15:00 CEST 2009,
triggerGroup=x3sReporting, previousFireTime=null, jobRunTime=-1,
jobDetail=JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false, result=null,
triggerName=clientError, fireTime=Tue Aug 25 11:10:00 CEST 2009,
mergedjobdatamap=org.quartz.jobdata...@ccc462dc,
jobinstance=org.apache.camel.component.quartz.camel...@1264f27,
scheduler=org.quartz.impl.stdschedu...@16975d, refireCount=0,
nextFireTime=Tue Aug 25 11:15:00 CEST 2009}, BodyType:org.quartz.JobDetail,
Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
11:10:03,187 | INFO  | heduler_Worker-1 | x3s                              |
rg.apache.camel.processor.Logger   88 | Exchange[
, BodyType:org.quartz.JobDetail
, Body:JobDetail
'DEFAULT.quartz://x3sReporting/clientError?cron=0+0%2F5+9-18+%3F+*+MON-FRI':
jobClass: 'org.apache.camel.component.quartz.CamelJob isStateful: false
isVolatile: false isDurable: false requestsRecovers: false
, CaughtExceptionType:java.lang.ClassCastException,
CaughtExceptionMessage:org.quartz.JobDetail,
StackTrace:java.lang.ClassCastException: org.quartz.JobDetail
    at
org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.marshal(BindyCsvDataFormat.java:60)

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Tue, Aug 25, 2009 at 10:47 AM, Claus Ibsen <[email protected]> wrote:

> On Tue, Aug 25, 2009 at 9:44 AM, Charles Moulliard<[email protected]>
> wrote:
> > Hi,
> >
> > I have the following question concerning the usage of pollEnrich
> processor
> > with queue and quartz endpoints.
> >
> > Is the following route correctly configured to pickup messages from a
> queue
> > every x minutes
> >
> > from(quartz:scheduler)
> > .pollEnrich(uri=Activemq:queue:MessagesToBeProcessed)
> > .to(bean:component:who will process the messages)
> >
>
> Try asking the computer it will tell. Yeah its should be something like
> that.
> You can provide an AggregationStrategy if you want to "merge" the polled
> result.
>
>
> > Additional question : Is it possible in Spring DSL to provide the ref of
> the
> > endpoint to the pollEnrich processor instead of an uri ?
> >
>
> No it currently only support an uri. At least in the Java DSL.
> Ref is to be added in the future.
>
> I cannot remember if the "ref" is in the Spring DSL. You can check
> yourself to see if there is an ref attribute to set on the
> <pollEnrich> XML tag.
>
>
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Reply via email to