Uploaded image for project: 'SwitchYard'
  1. SwitchYard
  2. SWITCHYARD-1760

camel-quartz-binding quartz:name cannot contain underscores

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0
    • Component/s: component-camel
    • Labels:
      None

      Description

      From Jiri Sedlacek:
      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tcunning Tom Cunningham
                  Reporter:
                  tcunning Tom Cunningham
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: