1 2 Previous Next 16 Replies Latest reply: May 18, 2012 7:41 AM by Keith Babo RSS

How to configure filesystem to MQ by switchyard camel component

David Zhu Newbie

As i am doing some investigations on how is it works that switchyard integration with Camel, I felt a little bit hard to understand the process of routing/processing/different pattern implementation by just providing 4 and 5 typical binding  samples.

  1. switchyard-quickstart-camel-binding   file/ftp/sftp/ftps -> swyd:service
  2. switchyard-quickstart-camel-jms-binding    queue monitor -> swyd:service
  3. switchyard-quickstart-camel-rest-binding    not start yet
  4. switchyard-quickstart-camel-service     Java DSL - swyd;service

 

but how to configure some other typical scenarios. for instance:

  1. filesystem - MQ
  2. filesystem - processorA - processorB - MQ

 

please advise how can i that helps?

 

thanks!

  • 1. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    If you are looking to start and end at a binding, then check out the camel soap proxy example:

     

    https://github.com/jboss-switchyard/quickstarts/tree/master/camel-soap-proxy

    https://github.com/jboss-switchyard/quickstarts/blob/master/camel-soap-proxy/src/main/resources/META-INF/switchyard.xml

     

    Now, the route will likely look a bit funky from a Camel perspective because it's missing a <from> element.  That's because we add a from://switchyard endpoint during deployment.  I'm guessing this will be confusing for existing Camel users, so I have filed a JIRA to allow the <from uri=switchyard://> endpoint to be specified directly in the route:

     

    https://issues.jboss.org/browse/SWITCHYARD-746

     

    In any case, when camel-soap-proxy is deployed, the route looks like this:

     

    <camel:implementation.camel>
           <spring:route>
                 <spring:from uri="switchyard://ProxyService"/>
              <spring:to uri="switchyard://ReverseService"/>
          </spring:route>
     </camel:implementation.camel>
    

     

    So we are routing from one SwitchYard endpoint to another in this example.  Both are bound to SOAP in the example, but they could be any other gateway binding (including Camel components) as well.  You can also add other routing logic, bean invocations, etc. in the route between the from and to.

     

    hth,

    keith

  • 2. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    The update would help to understand samples.

     

    Furthermore, do we have a detailed specification for switchyard xml?

  • 3. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    Our documentation covers the config a bit:

    https://docs.jboss.org/author/display/SWITCHYARD/Configuration

     

    You can also find the SwitchYard schema here:

    https://github.com/jboss-switchyard/core/blob/master/config/src/main/resources/org/switchyard/config/model/switchyard/v1/switchyard-v1.xsd

     

    The switchyard descriptor is basically a wrapper around an SCA composite + some extensions.

  • 4. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    Hi Keith,

     

    Really appreciate above response that helped me a lots to understand switchyard endpoint binding. but when i tried to bind sftp endpoint by

     

    <service name="FileReader" promote="FileReader">

                            <!-- Local file -->

                <!-- <camel:binding.camel configURI="file:d://test?fileName=order.csv&amp;initialDelay=50&amp;delete=true"/> -->

                <!-- Remote file over sftp -->

                <camel:binding.camel configURI="sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true"/>

            </service>

     

    Deployment always failed and error message displayed:

    15:43:16,396 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start s

    ervice jboss.deployment.unit."switchyard-quickstart-camel-service.jar".SwitchYardService: org.jboss.

    msc.service.StartException in service jboss.deployment.unit."switchyard-quickstart-camel-service.jar

    ".SwitchYardService: org.switchyard.exception.SwitchYardException: org.apache.camel.FailedToCreateRo

    uteException: Failed to create route {urn:switchyard-quickstart:camel-service:0.1.0}FileReader-[sftp

    ://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true]: Route[[From[sftp://d

    emo:demo@192.168.0.100:22/home/demo/orde... because of Failed to resolve endpoint: sftp://demo:demo@

    192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true due to: No component found with sch

    eme: sftp

            at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:79)

            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.

    java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746

    ) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.j

    ar:1.6.0_27]

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1

    .6.0_27]

            at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]

    Caused by: org.switchyard.exception.SwitchYardException: org.apache.camel.FailedToCreateRouteExcepti

    on: Failed to create route {urn:switchyard-quickstart:camel-service:0.1.0}FileReader-[sftp://demo:de

    mo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true]: Route[[From[sftp://demo:demo@1

    92.168.0.100:22/home/demo/orde... because of Failed to resolve endpoint: sftp://demo:demo@192.168.0.

    100:22/home/demo/order.csv&initialDelay=50&delete=true due to: No component found with scheme: sftp

            at org.switchyard.component.camel.InboundHandler.<init>(InboundHandler.java:81)

            at org.switchyard.component.camel.deploy.CamelActivator.activateBinding(CamelActivator.java:

    100)

            at org.switchyard.deploy.internal.Deployment.deployServiceBindings(Deployment.java:431)

            at org.switchyard.deploy.internal.Deployment.start(Deployment.java:141)

            at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.j

    ava:103)

            at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:72)

            ... 5 more

    Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route {urn:switchyard-qui

    ckstart:camel-service:0.1.0}FileReader-[sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initia

    lDelay=50&delete=true]: Route[[From[sftp://demo:demo@192.168.0.100:22/home/demo/orde... because of F

    ailed to resolve endpoint: sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&del

    ete=true due to: No component found with scheme: sftp

            at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)

            at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:705)

            at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:

    1659)

            at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:64

    9)

            at org.apache.camel.impl.DefaultCamelContext.addRouteDefinition(DefaultCamelContext.java:654

    )

            at org.switchyard.component.camel.InboundHandler.<init>(InboundHandler.java:79)

            ... 10 more

    Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sftp://demo:

    demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true due to: No component found wit

    h scheme: sftp

            at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:457)

            at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)

     

     

            at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)

            at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)

            at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)

            at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)

            at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)

            at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:772)

            at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)

            ... 15 more

     

     

    15:43:16,439 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deplo

    yment "switchyard-quickstart-camel-service.jar" was rolled back with failure message {"JBAS014671: F

    ailed services" => {"jboss.deployment.unit.\"switchyard-quickstart-camel-service.jar\".SwitchYardSer

    vice" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-quickst

    art-camel-service.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: org.apache.

    camel.FailedToCreateRouteException: Failed to create route {urn:switchyard-quickstart:camel-service:

    0.1.0}FileReader-[sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true]

    : Route[[From[sftp://demo:demo@192.168.0.100:22/home/demo/orde... because of Failed to resolve endpo

    int: sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true due to: No co

    mponent found with scheme: sftp"}}

    15:43:16,440 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016009: Stopping weld serv

    ice for deployment switchyard-quickstart-camel-service.jar

    15:43:16,459 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped dep

    loyment switchyard-quickstart-camel-service.jar in 20ms

    15:43:16,461 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service sta

    tus report

    JBAS014777:   Services which failed to start:      service jboss.deployment.unit."switchyard-quickst

    art-camel-service.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.depl

    oyment.unit."switchyard-quickstart-camel-service.jar".SwitchYardService: org.switchyard.exception.Sw

    itchYardException: org.apache.camel.FailedToCreateRouteException: Failed to create route {urn:switch

    yard-quickstart:camel-service:0.1.0}FileReader-[sftp://demo:demo@192.168.0.100:22/home/demo/order.cs

    v&initialDelay=50&delete=true]: Route[[From[sftp://demo:demo@192.168.0.100:22/home/demo/orde... beca

    use of Failed to resolve endpoint: sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDela

    y=50&delete=true due to: No component found with scheme: sftp

     

     

    15:43:16,469 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS01

    4653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" =>

    {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-quickstart-camel-service.jar\

    ".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"swi

    tchyard-quickstart-camel-service.jar\".SwitchYardService: org.switchyard.exception.SwitchYardExcepti

    on: org.apache.camel.FailedToCreateRouteException: Failed to create route {urn:switchyard-quickstart

    :camel-service:0.1.0}FileReader-[sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=

    50&delete=true]: Route[[From[sftp://demo:demo@192.168.0.100:22/home/demo/orde... because of Failed t

    o resolve endpoint: sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=tru

    e due to: No component found with scheme: sftp"}}}}

     

    how can I set up sftp component?

     

    and how about ftp/ftps component.

  • 5. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    You are one day early with this question.  The Camel FTP component is not included in our distribution yet.  Lukasz completed this on Monday:

     

    https://issues.jboss.org/browse/SWITCHYARD-745

     

    I just need to push it upstream. Assuming there are no issues, it will be in tonight's nightly build.

  • 6. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    Keith,

     

    What you mean is we can have swyd 0.5 distribution today?  There is nothing to worry about sftp/ftps component, right?

     

    David

  • 7. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    We publish nightly builds via our Jenkins release build.  Looks like last night's build has not been pushed out to the public instance yet, but this is where you would pick it up:

     

    http://hudson.jboss.org/hudson/job/SwitchYard-Release/

     

    I'm guessing it will publish out within the next few hours.  Builds from #437 on will have the FTP support.  Let us know if you run into any issues.

  • 8. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    Keith, I downloaded the #437 distribution from your CI environment and still failed to start up that demo.

     

    pom.xml

     


    <properties>


    <switchyard.version>0.5.0-SNAPSHOT</switchyard.version>

    </properties>

     

    switchyard.xml

    <service name="FileReader" promote="FileReader">

                <!-- Local file -->

                <!-- <camel:binding.camel configURI="file:d://test?fileName=order.csv&amp;initialDelay=50&amp;delete=true"/> -->

                <!-- Remote file over sftp -->

           <camel:binding.camel configURI="sftp://demo:demo@192.168.0.100:22/home/demo/order.csv&initialDelay=50&delete=true"/>

    </service>

     

    recompile - package - deploy

    ---

    console error:

    14:52:16,808 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS0150

    52: Did not receive a response to the deployment operation within the allowed timeout period [60 sec

    onds]. Check the server configuration file and the server logs to find more about the status of the

    deployment.

     

    deploy failed.

  • 9. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    Hey David,

     

    Is there anything else in the server log beyond that error?  If so, could you set DEBUG for the "org.switchyard" and "org.apache.camel" logger categories in standalone.xml (you'll need to add them) and try again?

     

    Lukasz has whipped up a Camel FTP quickstart which we will push in today.  That should also help provide a baseline for testing.

     

    cheers,

    keith

  • 10. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    Build #440 contains the latest fixes for FTP component and also includes an FTP quickstart.  My recommendation would be to start with the quickstart and make sure that works for you.  Then tweak it to use the FTP options you want (e.g. SFTP) slowly and see how far you get before something goes bad.

     

    https://github.com/jboss-switchyard/quickstarts/tree/master/camel-ftp-binding

  • 11. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    yes, sounds great. i am expecting 440 build..... really appreciated for following up this.

     

    seems hudson server was crash down http://hudson.jboss.org/hudson/job/SwitchYard-Release/................

  • 12. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    Hi Keith,

     

    It's not easy to generate switchyard-0.5.0.SNAPSHOT by myself. many dependencies i have to figure out manually. But finally i got that and also faced the issues for packaging ftp sample. if you could help on that asap that would be really appreciated! Waiting online

     

    Failed to execute goal org.switchyard:switchyard-plugin:0.5.0-SNAPSHOT:configure (default) on project switchyard-quickstart-camel-ftp-binding: Model [org.switchyard.config.model.switchyard.v1.V1SwitchYardModel] is invalid: cvc-complex-type.2.4.a: Invalid content was found starting with element 'camel:directory'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200912":wireFormat, "http://docs.oasis-open.org/ns/opencsa/sca/200912":operationSelector, "http://docs.oasis-open.org/ns/opencsa/sca/200912":requires, "http://docs.oasis-open.org/ns/opencsa/sca/200912":policySetAttachment, "urn:switchyard-config:switchyard:1.0":contextMapper, "urn:switchyard-config:switchyard:1.0":messageComposer, "urn:switchyard-component-camel:config:1.0":operationSelector}' is expected. -> [Help 1]

  • 13. Re: How to configure filesystem to MQ by switchyard camel component
    David Zhu Newbie

    finally, i resolved this problem by packaging and reinstalling camel component. By now ftp protocal works fine, and seems support camel syntax as well. Good job and congrats!

    but the configuration seems not work

    <camel.delete>true</camel.delete> inside of <camel.consume> .

     

    I'd like to test sftp and ftps tomorrow.

     

    thanks!

  • 14. Re: How to configure filesystem to MQ by switchyard camel component
    Keith Babo Master

    Glad it's working but I'm a bit concerned about the effort that you had to go through.  It should really just be a matter of downloading the latest SwitchYard AS7 distribution and using 0.5.0-SNAPSHOT for the dependencies in your application project.  If you had to do more than that, then I would like to hear about it since that would be considered a bug.

1 2 Previous Next