Re: camel-quartz failed camel route creation when database is unreachable

2016-12-20 Thread Rachid KRAIEM
Hello,

Yes, it's my message

Cordialement,

*Rachid KRAIEM*




2016-12-20 17:45 GMT+01:00 Rachid KRAIEM [via Camel] <
ml-node+s465427n5791747...@n5.nabble.com>:

> Hi,
>
> Given the best practice is not to change the APIs, can you raise a JIRA
> that contain this solution and include him in the next release of
> camel-quartz ?
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-
> route-creation-when-database-is-unreachable-tp5789552p5791747.html
> To unsubscribe from camel-quartz failed camel route creation when database
> is unreachable, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5789552&code=cmFjaGlka3JhaWVtQGdtYWlsLmNvbXw1Nzg5NTUyfC0xMDI3MzAyOTk=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5791749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-quartz failed camel route creation when database is unreachable

2016-12-20 Thread Rachid KRAIEM
Hi,

Given the best practice is not to change the APIs, can you raise a JIRA that
contain this solution and include him in the next release of camel-quartz ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5791747.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-quartz failed camel route creation when database is unreachable

2016-11-07 Thread Rachid KRAIEM
Thanks Claus,

Can you raise a JIRA that contain this solution ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5789852.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-quartz failed camel route creation when database is unreachable

2016-11-07 Thread Claus Ibsen
 = getComponent().getScheduler();
> JobDetail jobDetail;
> Trigger oldTrigger = null;
> //parameter added for check existing database connection
> boolean hasConn = true;
> try {
> oldTrigger = scheduler.getTrigger(getTriggerKey());
> } catch (org.quartz.JobPersistenceException e) {
> // catch Exception added by me, that permit to 
> continue
> // creating new CamelJob when database connection is 
> unreachable
> hasConn = false;
> LOG.error("Customized ERROR : " + e.getMessage() + " 
> : " + e.getCause());
> }
> boolean triggerExisted = oldTrigger != null;
> if (triggerExisted && !isRecoverableJob()) {
> ensureNoDupTriggerKey();
> }
>
> jobDetail = createJobDetail();
> Trigger trigger = createTrigger(jobDetail);
>
> QuartzHelper.updateJobDataMap(getCamelContext(), jobDetail,
> getEndpointUri(), isUsingFixedCamelContextName());
>
> if (triggerExisted) {
> // Reschedule job if trigger settings were changed
> if (hasTriggerChanged(oldTrigger, trigger)) {
> scheduler.rescheduleJob(getTriggerKey(), 
> trigger);
> }
> // condition added by me make job scheduling only when
> // database connection exist
> } else if (hasConn) {
> try {
> // Schedule it now. Remember that scheduler 
> might not be started
> // it, but we can schedule now.
> scheduler.scheduleJob(jobDetail, trigger);
> } catch (ObjectAlreadyExistsException ex) {
> // some other VM might may have stored the 
> job & trigger in DB
> // in clustered mode, in the mean time
> if (!(getComponent().isClustered())) {
> throw ex;
> } else {
> trigger = 
> scheduler.getTrigger(getTriggerKey());
> if (trigger == null) {
> throw new 
> SchedulerException("Trigger could not be found in quartz
> scheduler.");
> }
> }
> }
> }
>
> if (LOG.isInfoEnabled()) {
> LOG.info("Job {} (triggerType={}, jobClass={}) is 
> scheduled. Next fire
> date is {}", new Object[] { trigger.getKey(),
>         trigger.getClass().getSimpleName(),
> jobDetail.getJobClass().getSimpleName(), trigger.getNextFireTime() });
> }
>
> // Increase camel job count for this endpoint
> AtomicInteger number = (AtomicInteger)
> scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
> if (number != null) {
> number.incrementAndGet();
> }
>
> jobAdded.set(true);
> }
>
>
>
> *You confirm this proposal?*
>
> CustomQuartzComponent.java
> <http://camel.465427.n5.nabble.com/file/n5789552/CustomQuartzComponent.java>
>
> CustomQuartzEndpoint.java
> <http://camel.465427.n5.nabble.com/file/n5789552/CustomQuartzEndpoint.java>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552.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: camel-quartz failed camel route creation when database is unreachable

2016-11-07 Thread souciance
I cannot comment on the code for starting the route when the database is
unavailable but why  not add some default properties to use when the
database is not available. Then you catch the exception and use those
properties instead.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5789827.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-quartz failed camel route creation when database is unreachable

2016-11-07 Thread Rachid KRAIEM
Hi Everyone,

Can you validate this proposal



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5789822.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-quartz failed camel route creation when database is unreachable

2016-11-01 Thread Rachid KRAIEM
   } else if (hasConn) {
try {
// Schedule it now. Remember that scheduler 
might not be started
// it, but we can schedule now.
scheduler.scheduleJob(jobDetail, trigger);
} catch (ObjectAlreadyExistsException ex) {
// some other VM might may have stored the job 
& trigger in DB
// in clustered mode, in the mean time
if (!(getComponent().isClustered())) {
throw ex;
} else {
trigger = 
scheduler.getTrigger(getTriggerKey());
if (trigger == null) {
throw new 
SchedulerException("Trigger could not be found in quartz
scheduler.");
}
}
}
}

if (LOG.isInfoEnabled()) {
LOG.info("Job {} (triggerType={}, jobClass={}) is 
scheduled. Next fire
date is {}", new Object[] { trigger.getKey(),
trigger.getClass().getSimpleName(),
jobDetail.getJobClass().getSimpleName(), trigger.getNextFireTime() });
}

// Increase camel job count for this endpoint
AtomicInteger number = (AtomicInteger)
scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
if (number != null) {
number.incrementAndGet();
}

jobAdded.set(true);
}



*You confirm this proposal?*

CustomQuartzComponent.java
<http://camel.465427.n5.nabble.com/file/n5789552/CustomQuartzComponent.java>  

CustomQuartzEndpoint.java
<http://camel.465427.n5.nabble.com/file/n5789552/CustomQuartzEndpoint.java>  





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552.html
Sent from the Camel - Users mailing list archive at Nabble.com.