Bug 972227 - camel-quartz-binding quartz:name cannot contain underscores
camel-quartz-binding quartz:name cannot contain underscores
Status: MODIFIED
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: Camel (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity high
: DR3
: ---
Assigned To: tcunning
Matej Melko
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-07 17:03 EDT by Jiri Sedlacek
Modified: 2015-11-02 03:06 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
The camel-quartz-binding quartz:name cannot contain underscores at the moment. If it does, an exception is thrown: org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:85). This is because the name is used as a URI. To work around this issue, avoid underscores in the quartz:name field.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SWITCHYARD-1760 Major Resolved camel-quartz-binding quartz:name cannot contain underscores 2015-07-21 08:35:26 EDT
Apache JIRA CAMEL-6851 None None None Never

  None (edit)
Description Jiri Sedlacek 2013-06-07 17:03:04 EDT
Switchyard composite created, binding is camel-quartz, configured as below: 

<quartz:binding.quartz>
   <operationSelector operationName="call"/>
   <quartz:name>quartz_bean_service</quartz:name>
   <quartz:cron>0/5 * * * * ?</quartz:cron>
</quartz:binding.quartz>

When deployed, not so clear exception is thrown:

at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:85)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
Caused by: org.switchyard.exception.SwitchYardException: org.apache.camel.FailedToCreateRouteException: Failed to create route V1CamelQuartzBindingModel/SimpleService@-1749185328: Route[[From[quartz://quartz_bean_service?cron=0/5%20*%20*%20... because of Failed to resolve endpoint: quartz://quartz_bean_service?cron=0%2F5+*+*+*+*+%3F due to: Trigger name cannot be null or empty.
	at org.switchyard.component.camel.common.handler.InboundHandler.<init>(InboundHandler.java:77)
	at org.switchyard.component.camel.common.deploy.BaseBindingActivator.createInboundHandler(BaseBindingActivator.java:71)
	at org.switchyard.component.camel.common.deploy.BaseBindingActivator.activateBinding(BaseBindingActivator.java:63)
	at org.switchyard.deploy.internal.Deployment.deployServiceBindings(Deployment.java:515)
	at org.switchyard.deploy.internal.Deployment.start(Deployment.java:141)
	at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:106)
	at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:78)
	... 5 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route V1CamelQuartzBindingModel/SimpleService@-1749185328: Route[[From[quartz://quartz_bean_service?cron=0/5%20*%20*%20... because of Failed to resolve endpoint: quartz://quartz_bean_service?cron=0%2F5+*+*+*+*+%3F due to: Trigger name cannot be null or empty.
	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:176)
	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:712)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1749)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:656)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinition(DefaultCamelContext.java:661)
	at org.switchyard.component.camel.common.handler.InboundHandler.<init>(InboundHandler.java:75)
	... 11 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: quartz://quartz_bean_service?cron=0%2F5+*+*+*+*+%3F due to: Trigger name cannot be null or empty.
	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:469)
	at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
	at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:186)
	at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107)
	at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113)
	at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
	at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:89)
	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:851)
	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)
	... 16 more
Caused by: java.lang.IllegalArgumentException: Trigger name cannot be null or empty.
	at org.quartz.Trigger.setName(Trigger.java:366)
	at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:149)
	at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:54)
	at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)
	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:451)
	... 24 more

What I found, camel endpoint is treated as URI in org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:149) method, and when quartz:name contains underscore (and probably other chars not allowed in URI), URI.getHost() returns null and this value is then set as trigger name.

This behaviour should be either documented or fixed, users don't have to know how it works internaly and may want to use names with underscores.
Comment 4 tcunning 2013-10-10 12:13:32 EDT
Logged a bug against Camel and provided a test case / patch.   The issue seems to be that although target names with underscores work for URIs where a trigger argument is specified, it doesn't work for the case where a cron argument is specified.
Comment 5 JBoss JIRA Server 2014-04-07 10:47:41 EDT
Tom Cunningham <tcunning@redhat.com> updated the status of jira SWITCHYARD-1760 to Resolved

Note You need to log in before you can comment on or make changes to this bug.