You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Christian Müller <ch...@gmail.com> on 2012/09/07 12:44:12 UTC

Camel Quartz component and the startDelayedSeconds attribute

Is there any reason why we don't support 'startDelayedSeconds' as URL
option? At present, we only supporting this by directly setting this in the
component:
<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
    <property name="propertiesFile"
value="com/mycompany/myquartz.properties"/>
</bean>

If not, I will go ahead and fix it, so that we can use it as URL option like
quartz://myGroup/myTimerName?startDelayedSeconds=5

Best,
Christian

--

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Christian Mueller <ch...@gmail.com>.
I decided to log a warning if the scheduler was already started or a
different startDelayedSeconds was already applied. I think it's more user
friendly instead of throwing an exception...

Best,
Christian



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Quartz-component-and-the-startDelayedSeconds-attribute-tp5718764p5718987.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Christian Müller <ch...@gmail.com>.
Thanks for the hint, but unfortunately we stick to 2.6.0 with this service
in the time being.

Best,
Christian

On Fri, Sep 7, 2012 at 1:28 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> If you use a recent version of Camel then in the unit test you can
> override the isUseAdviceWith  method and return true.
> So bottom of:
> http://camel.apache.org/advicewith.html
>
> Then it ought to defer starting Camel, and you can do your
> interceptors and whatnot. And then start Camel.
>
>
> On Fri, Sep 7, 2012 at 1:22 PM, Christian Müller
> <ch...@gmail.com> wrote:
> > Thanks for the detailed explanation Claus. I create a JIRA for it [1] and
> > will go ahead.
> >
> > Some details about our "problem":
> > We face this only in our unit tests where we use
> "interseptSendToEndpoint"
> > to mock an endpoint and throw an exception to test the exceptional use
> > case. Because the Quartz component sent the trigger message before we
> could
> > modify the route in our unit test, we have to delay it. We could solve
> the
> > problem by moving this "interseptSendToEndpoint" into the setUp method,
> but
> > this requires us to have a separate unit test for each different
> > exceptional unit test.
> >
> > [1] https://issues.apache.org/jira/browse/CAMEL-5577
> >
> > Best,
> > Christian
> >
> > On Fri, Sep 7, 2012 at 1:02 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Fri, Sep 7, 2012 at 12:44 PM, Christian Müller
> >> <ch...@gmail.com> wrote:
> >> > Is there any reason why we don't support 'startDelayedSeconds' as URL
> >> > option? At present, we only supporting this by directly setting this
> in
> >> the
> >> > component:
> >> > <bean id="quartz"
> >> class="org.apache.camel.component.quartz.QuartzComponent">
> >> >     <property name="propertiesFile"
> >> > value="com/mycompany/myquartz.properties"/>
> >> > </bean>
> >> >
> >> > If not, I will go ahead and fix it, so that we can use it as URL
> option
> >> like
> >> > quartz://myGroup/myTimerName?startDelayedSeconds=5
> >> >
> >>
> >> Its a component level option only, as the scheduler is tied to the
> >> lifecycle of the component.
> >>
> >> So you can't really use it on an endpoint. What if you have 2+
> >> endpoints, each with a different value of that option.
> >> There is only 1 scheduler on the component.
> >>
> >> A "trick" could be though to allow endpoint to configure this option
> >> on the component, if the component hasn't been started etc.
> >> Then it makes it easier for end users, as they dont need to setup a
> >> <bean> for the quartz component.
> >>
> >> And if 2 endpoints tries to configure the same option, we could barf
> >> and fail, and tell it has already been configured? Or
> >> we could log a WARN that we override the value etc.
> >>
> >> So despite being a component option, it could maybe make it nice to
> >> have in endpoint as well, so ppl dont have to configure the <bean>
> >> just for that option. And it makes it simpler if you have 1 quartz
> >> endpoint.
> >>
> >> > Best,
> >> > Christian
> >> >
> >> > --
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
> >
> >
> >
> > --
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



--

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you use a recent version of Camel then in the unit test you can
override the isUseAdviceWith  method and return true.
So bottom of:
http://camel.apache.org/advicewith.html

Then it ought to defer starting Camel, and you can do your
interceptors and whatnot. And then start Camel.


On Fri, Sep 7, 2012 at 1:22 PM, Christian Müller
<ch...@gmail.com> wrote:
> Thanks for the detailed explanation Claus. I create a JIRA for it [1] and
> will go ahead.
>
> Some details about our "problem":
> We face this only in our unit tests where we use "interseptSendToEndpoint"
> to mock an endpoint and throw an exception to test the exceptional use
> case. Because the Quartz component sent the trigger message before we could
> modify the route in our unit test, we have to delay it. We could solve the
> problem by moving this "interseptSendToEndpoint" into the setUp method, but
> this requires us to have a separate unit test for each different
> exceptional unit test.
>
> [1] https://issues.apache.org/jira/browse/CAMEL-5577
>
> Best,
> Christian
>
> On Fri, Sep 7, 2012 at 1:02 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Fri, Sep 7, 2012 at 12:44 PM, Christian Müller
>> <ch...@gmail.com> wrote:
>> > Is there any reason why we don't support 'startDelayedSeconds' as URL
>> > option? At present, we only supporting this by directly setting this in
>> the
>> > component:
>> > <bean id="quartz"
>> class="org.apache.camel.component.quartz.QuartzComponent">
>> >     <property name="propertiesFile"
>> > value="com/mycompany/myquartz.properties"/>
>> > </bean>
>> >
>> > If not, I will go ahead and fix it, so that we can use it as URL option
>> like
>> > quartz://myGroup/myTimerName?startDelayedSeconds=5
>> >
>>
>> Its a component level option only, as the scheduler is tied to the
>> lifecycle of the component.
>>
>> So you can't really use it on an endpoint. What if you have 2+
>> endpoints, each with a different value of that option.
>> There is only 1 scheduler on the component.
>>
>> A "trick" could be though to allow endpoint to configure this option
>> on the component, if the component hasn't been started etc.
>> Then it makes it easier for end users, as they dont need to setup a
>> <bean> for the quartz component.
>>
>> And if 2 endpoints tries to configure the same option, we could barf
>> and fail, and tell it has already been configured? Or
>> we could log a WARN that we override the value etc.
>>
>> So despite being a component option, it could maybe make it nice to
>> have in endpoint as well, so ppl dont have to configure the <bean>
>> just for that option. And it makes it simpler if you have 1 quartz
>> endpoint.
>>
>> > Best,
>> > Christian
>> >
>> > --
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>
>
>
> --



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Christian Müller <ch...@gmail.com>.
Thanks for the detailed explanation Claus. I create a JIRA for it [1] and
will go ahead.

Some details about our "problem":
We face this only in our unit tests where we use "interseptSendToEndpoint"
to mock an endpoint and throw an exception to test the exceptional use
case. Because the Quartz component sent the trigger message before we could
modify the route in our unit test, we have to delay it. We could solve the
problem by moving this "interseptSendToEndpoint" into the setUp method, but
this requires us to have a separate unit test for each different
exceptional unit test.

[1] https://issues.apache.org/jira/browse/CAMEL-5577

Best,
Christian

On Fri, Sep 7, 2012 at 1:02 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Fri, Sep 7, 2012 at 12:44 PM, Christian Müller
> <ch...@gmail.com> wrote:
> > Is there any reason why we don't support 'startDelayedSeconds' as URL
> > option? At present, we only supporting this by directly setting this in
> the
> > component:
> > <bean id="quartz"
> class="org.apache.camel.component.quartz.QuartzComponent">
> >     <property name="propertiesFile"
> > value="com/mycompany/myquartz.properties"/>
> > </bean>
> >
> > If not, I will go ahead and fix it, so that we can use it as URL option
> like
> > quartz://myGroup/myTimerName?startDelayedSeconds=5
> >
>
> Its a component level option only, as the scheduler is tied to the
> lifecycle of the component.
>
> So you can't really use it on an endpoint. What if you have 2+
> endpoints, each with a different value of that option.
> There is only 1 scheduler on the component.
>
> A "trick" could be though to allow endpoint to configure this option
> on the component, if the component hasn't been started etc.
> Then it makes it easier for end users, as they dont need to setup a
> <bean> for the quartz component.
>
> And if 2 endpoints tries to configure the same option, we could barf
> and fail, and tell it has already been configured? Or
> we could log a WARN that we override the value etc.
>
> So despite being a component option, it could maybe make it nice to
> have in endpoint as well, so ppl dont have to configure the <bean>
> just for that option. And it makes it simpler if you have 1 quartz
> endpoint.
>
> > Best,
> > Christian
> >
> > --
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



--

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Sep 7, 2012 at 12:44 PM, Christian Müller
<ch...@gmail.com> wrote:
> Is there any reason why we don't support 'startDelayedSeconds' as URL
> option? At present, we only supporting this by directly setting this in the
> component:
> <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
>     <property name="propertiesFile"
> value="com/mycompany/myquartz.properties"/>
> </bean>
>
> If not, I will go ahead and fix it, so that we can use it as URL option like
> quartz://myGroup/myTimerName?startDelayedSeconds=5
>

Its a component level option only, as the scheduler is tied to the
lifecycle of the component.

So you can't really use it on an endpoint. What if you have 2+
endpoints, each with a different value of that option.
There is only 1 scheduler on the component.

A "trick" could be though to allow endpoint to configure this option
on the component, if the component hasn't been started etc.
Then it makes it easier for end users, as they dont need to setup a
<bean> for the quartz component.

And if 2 endpoints tries to configure the same option, we could barf
and fail, and tell it has already been configured? Or
we could log a WARN that we override the value etc.

So despite being a component option, it could maybe make it nice to
have in endpoint as well, so ppl dont have to configure the <bean>
just for that option. And it makes it simpler if you have 1 quartz endpoint.

> Best,
> Christian
>
> --



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel Quartz component and the startDelayedSeconds attribute

Posted by Christian Müller <ch...@gmail.com>.
Sorry, I mean:
<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
    <property name="startDelayedSeconds" value="5"/>
</bean>

Best,
Christian

On Fri, Sep 7, 2012 at 12:44 PM, Christian Müller <
christian.mueller@gmail.com> wrote:

> Is there any reason why we don't support 'startDelayedSeconds' as URL
> option? At present, we only supporting this by directly setting this in the
> component:
> <bean id="quartz"
> class="org.apache.camel.component.quartz.QuartzComponent">
>     <property name="propertiesFile"
> value="com/mycompany/myquartz.properties"/>
> </bean>
>
> If not, I will go ahead and fix it, so that we can use it as URL option
> like
> quartz://myGroup/myTimerName?startDelayedSeconds=5
>
> Best,
> Christian
>
> --
>
>
>


--