You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by freakwave10 <wb...@gmail.com> on 2016/11/09 23:15:44 UTC

quartz2 component on wildfly 10.1

Hi all,

I have a hard time getting the quartz component to run.
 I need to specify a custom quartz.properties file

Unfortunately the quartz.properties is always used from the jar file
included in:
C:\Programs\wildfly-10.1.0.Final\modules\system\layers\fuse\org\quartz\main

Now I tried several ways of fixing this:
1) define my own camel context, own scheduler and execute:

QuartzComponent quartzComp = new QuartzComponent(camelContext);
quartzComp.setScheduler(quartzSchedulerFactory.getGlobalScheduler());
camelContext.addComponent("quartz2", quartzComp);
startPolicy.setRouteStartTime("*10 * * * * ?");
...
but there are 2 issues:

1) when I add the route, it does not find the "quartz2" component
2016-11-10 00:11:51,178 DEBUG [org.apache.camel.util.ResolverHelper] -
Lookup Component with name quartz2 in registry. Found: null
2016-11-10 00:11:51,178 DEBUG [org.apache.camel.util.ResolverHelper] -
Lookup Component with name quartz2-component in registry. Found: null

2) since it does not find the component, it will create a new quartz
scheduler with the properties file of the module and in addition, the
following exception is thrown:

org.apache.camel.FailedToCreateRouteException: Failed to create route
testRoute: Route(testRoute)[[From[direct:start], From[jpa://com.kona.eb...
because of org.quartz.ObjectAlreadyExistsException: Unable to store Job :
'jobGroup-testRoute.job-START-testRoute', because one already exists with
this identification.
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)

Environment:

wildfly 10.1
camel wildfly module

Thanks for your help

Thanks for your help,

Wolfgang




--
View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: quartz2 component on wildfly 10.1

Posted by freakwave10 <wb...@gmail.com>.
Hi John,

just to make sure, I use now a very clean war file, that has basically only
CDI component and one camel routeBuilder class deployed.


package com.kona.camel.routes;
import javax.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cdi.ContextName;
import org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy;
import com.kona.cdi.annotation.Startup;

@Startup
@ApplicationScoped
@ContextName("cdi-context")
public class MyRouteBuilder extends RouteBuilder {

    @Override
    public void configure() throws Exception {
    	CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy();
		startPolicy.setRouteStartTime("*/10 * * * * ?");
     	from("direct:start").routeId("testRoute").routePolicy(startPolicy)
     	.from("sql:select * from seamv2.geosecmgr?dataSource=#epmDataSoruce")
     	.to("log:sql?showAll=true");
    }
}

Same issue, the scheduler always uses the quartz.properties that comes with
the fuse wildfly module.
RAM Job Store and the job can not be stored because it already exists.

jboss-log.txt
<http://camel.465427.n5.nabble.com/file/n5790020/jboss-log.txt>  

I uploaded the jboss log file.

Thanks for your help,

Wolfgang





--
View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975p5790020.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: quartz2 component on wildfly 10.1

Posted by "John D. Ament" <jo...@apache.org>.
Hi,

Another thing to look at, are you using a common quartz instance that has
job persistence enabled (e.g. a database job store instead of RAMJobStore)?

John

On Thu, Nov 10, 2016 at 7:10 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> You can maybe use CDI @Produces bean that has a method that produces
> the component
>
> @Produces
> public QuartzComponent myQuartzComponent(CamelContext camelContext) {
>     // code here to setup the component
> }
>
> That is more normal way of doing stuff like that with CDI.
>
> However can you show us a bit more where you create that quartz
> component and add to CamelContext? Do you do that from a RouteBuilder
> in the configure method or where?
>
> We had a recent issue with OSGi blueprint where some users did that
> and the component resolver couldnt find the component. Maybe similar
> fix is needed for wildfly-camel / camel-cdi etc.
>
> https://issues.apache.org/jira/browse/CAMEL-10394
>
> On Thu, Nov 10, 2016 at 12:27 PM, freakwave10 <wb...@gmail.com>
> wrote:
> > Sure:
> >
> > Wildfly 10.1
> > Apache Camel Subsystem: 4.3.0
> >
> > I have no routes defined in the standalone-full.xml of wildfly, so the
> only
> > entry is:
> >
> > <subsystem xmlns="urn:jboss:domain:camel:1.0"/>
> >
> > My application is deployed in an ear file using CDI/deltaspike/Quartz2/
> ....
> >
> > So I have a quartz scheduler up and running.
> > At the end I want to define my own scheduler configuration just for
> camel.
> > But here I was completely unsuccessful of telling the camel-quartz
> component
> > to use a different quartz.properties.
> >
> > Thanks for your help,
> >
> > Wolfgang
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975p5789999.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: quartz2 component on wildfly 10.1

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

You can maybe use CDI @Produces bean that has a method that produces
the component

@Produces
public QuartzComponent myQuartzComponent(CamelContext camelContext) {
    // code here to setup the component
}

That is more normal way of doing stuff like that with CDI.

However can you show us a bit more where you create that quartz
component and add to CamelContext? Do you do that from a RouteBuilder
in the configure method or where?

We had a recent issue with OSGi blueprint where some users did that
and the component resolver couldnt find the component. Maybe similar
fix is needed for wildfly-camel / camel-cdi etc.

https://issues.apache.org/jira/browse/CAMEL-10394

On Thu, Nov 10, 2016 at 12:27 PM, freakwave10 <wb...@gmail.com> wrote:
> Sure:
>
> Wildfly 10.1
> Apache Camel Subsystem: 4.3.0
>
> I have no routes defined in the standalone-full.xml of wildfly, so the only
> entry is:
>
> <subsystem xmlns="urn:jboss:domain:camel:1.0"/>
>
> My application is deployed in an ear file using CDI/deltaspike/Quartz2/ ....
>
> So I have a quartz scheduler up and running.
> At the end I want to define my own scheduler configuration just for camel.
> But here I was completely unsuccessful of telling the camel-quartz component
> to use a different quartz.properties.
>
> Thanks for your help,
>
> Wolfgang
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975p5789999.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: quartz2 component on wildfly 10.1

Posted by Claus Ibsen <cl...@gmail.com>.
Also you may want to reach out the wildfly-camel team to get help from
them. It seems there is some room for improvement / little bug in
there. It should IMHO be possible to specify a different
quartz.properties file for the quartz component to use. It surely is
possible with vanilla Apache Camel.

https://github.com/wildfly-extras/wildfly-camel


On Thu, Nov 10, 2016 at 12:27 PM, freakwave10 <wb...@gmail.com> wrote:
> Sure:
>
> Wildfly 10.1
> Apache Camel Subsystem: 4.3.0
>
> I have no routes defined in the standalone-full.xml of wildfly, so the only
> entry is:
>
> <subsystem xmlns="urn:jboss:domain:camel:1.0"/>
>
> My application is deployed in an ear file using CDI/deltaspike/Quartz2/ ....
>
> So I have a quartz scheduler up and running.
> At the end I want to define my own scheduler configuration just for camel.
> But here I was completely unsuccessful of telling the camel-quartz component
> to use a different quartz.properties.
>
> Thanks for your help,
>
> Wolfgang
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975p5789999.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: quartz2 component on wildfly 10.1

Posted by freakwave10 <wb...@gmail.com>.
Sure:

Wildfly 10.1
Apache Camel Subsystem: 4.3.0

I have no routes defined in the standalone-full.xml of wildfly, so the only
entry is:

<subsystem xmlns="urn:jboss:domain:camel:1.0"/>

My application is deployed in an ear file using CDI/deltaspike/Quartz2/ ....

So I have a quartz scheduler up and running.
At the end I want to define my own scheduler configuration just for camel. 
But here I was completely unsuccessful of telling the camel-quartz component
to use a different quartz.properties.

Thanks for your help,

Wolfgang 



--
View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975p5789999.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: quartz2 component on wildfly 10.1

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

Can you tell us a bit more how you deploy and run your Camel
application in wildfly? eg are you using WAR files or wildfly-camel
subsystem or something else?
https://github.com/wildfly-extras/wildfly-camel


And what version of Camel are you using?

On Thu, Nov 10, 2016 at 12:15 AM, freakwave10 <wb...@gmail.com> wrote:
> Hi all,
>
> I have a hard time getting the quartz component to run.
>  I need to specify a custom quartz.properties file
>
> Unfortunately the quartz.properties is always used from the jar file
> included in:
> C:\Programs\wildfly-10.1.0.Final\modules\system\layers\fuse\org\quartz\main
>
> Now I tried several ways of fixing this:
> 1) define my own camel context, own scheduler and execute:
>
> QuartzComponent quartzComp = new QuartzComponent(camelContext);
> quartzComp.setScheduler(quartzSchedulerFactory.getGlobalScheduler());
> camelContext.addComponent("quartz2", quartzComp);
> startPolicy.setRouteStartTime("*10 * * * * ?");
> ...
> but there are 2 issues:
>
> 1) when I add the route, it does not find the "quartz2" component
> 2016-11-10 00:11:51,178 DEBUG [org.apache.camel.util.ResolverHelper] -
> Lookup Component with name quartz2 in registry. Found: null
> 2016-11-10 00:11:51,178 DEBUG [org.apache.camel.util.ResolverHelper] -
> Lookup Component with name quartz2-component in registry. Found: null
>
> 2) since it does not find the component, it will create a new quartz
> scheduler with the properties file of the module and in addition, the
> following exception is thrown:
>
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> testRoute: Route(testRoute)[[From[direct:start], From[jpa://com.kona.eb...
> because of org.quartz.ObjectAlreadyExistsException: Unable to store Job :
> 'jobGroup-testRoute.job-START-testRoute', because one already exists with
> this identification.
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
>
> Environment:
>
> wildfly 10.1
> camel wildfly module
>
> Thanks for your help
>
> Thanks for your help,
>
> Wolfgang
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/quartz2-component-on-wildfly-10-1-tp5789975.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2