camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan S. Dubrov (JIRA)" <>
Subject [jira] Updated: (CAMEL-1185) Message-triggered scheduling (producer for camel-quartz)
Date Fri, 12 Dec 2008 10:24:05 GMT


Ivan S. Dubrov updated CAMEL-1185:

    Attachment: quartz-triggered.patch

Attached patch with unit tests.

Looking at the linked issue, I think of different approach to producer implementation. Instead
of requiring the consumer with exactly the same endpoint URI (as in my implementation), it
is probably better to specify the target endpoint URI in the producer endpoint URI parameter.

Instead of two routes:

from("direct:start").setHeader("startTime", constant(startTime)).to("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1&dynamic=true");

that could be like:

from("direct:start").setHeader("startTime", constant(startTime)).to("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1&target=mock:results");

The advantage is that if Quartz is in clustered mode, the former approach will require having
the consumer declared on each node Quartz is running on. The latter approach is more flexible
(you can specify, for example, "jms:somequeue" which will work on every node, requiring only
minimal JMS configuration).

What do you think?

> Message-triggered scheduling (producer for camel-quartz)
> --------------------------------------------------------
>                 Key: CAMEL-1185
>                 URL:
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-quartz
>    Affects Versions: 1.5.1, 2.0.0
>            Reporter: Ivan S. Dubrov
>         Attachments: quartz-triggered.patch, quartz-triggered.patch
> I suggest implementing the producer for the Quartz component that will enable scheduling
the message delivery driven by the incoming messages.
> The idea is that instead of creating trigger when consumer is created, create trigger
when message is sent to the endpoint, taking additional trigger parameters from the headers.
> For example:
> <route>
>     ...
>     <setHeader headerName="startTime">
>         <!-- Assume the XPath returns java.util.Date (actually, extra converter is
required) -->
>         <xpath>/notification/@time</xpath>
>     </setHeader>
>     <!-- 
>       Create trigger with repeat count to 3 and interval of 10 seconds.
>       The start time is retrieved from the header
>      -->
>     <to uri="quartz://requests?trigger.repeatCount=3&amp;trigger.repeatInterval=10000&amp;dynamic=true"
> </route>
> <route>
>     <!-- Create consumer -->
>     <from uri="quartz://requests?trigger.repeatCount=3&amp;trigger.repeatInterval=10000&amp;dynamic=true"
>     ...
> </route>
> So, if we have <notification time="2008-12-11T22:06:00Z">...Notification data...</notification>
sent to the endpoint in the first route, the trigger will be created targeted at time specified
in the "time" attribute. When Quartz will fire the trigger, the message will be sent in the
second route.
> It could be used as a kind of "delayer", but more flexible and featureful. For example,
for delaying messages for a long time (week, days, etc), when resequencer+delayer will not
work (as far as I understand).
> The patch is provided. However, it has several drawbacks:
> 1) in "dynamic" mode (when scheduling is triggered by incoming messages) group/name parsed
from the endpoint URI is not used, trigger and job receive name from the exchange id
> 2) The consumer/producer part of the URI must be exactly equal (because the consumer/producer
must be created exactly by the same endpoint).
> 3) It will not work when Quartz is clustered (the endpoint URI should be stored instead
of endpoint reference, see CAMEL-1002 which fixes this)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message