7 Replies Latest reply on Jan 14, 2013 6:03 AM by hamid1982

    Migration jboss ESB to switchYard file binding

    hamid1982

      Hi,

       

      I'm trying to migrate an application from jboss esb to switchyard. The current application Consist sniffer a root a directory in which you put the xml files. once a xml file is placed in this directory it is absorbed by jboss esb.

       

      Is there a way to implement a Listner running in permanence on the source folder which we can use with the binding file mentioned in the user guide ?

       

      Best Regards.

        • 1. Re: Migration jboss ESB to switchYard file binding
          kcbabo

          You can use the file gateway in SwitchYard to pull files from a directory and invoke a service.  The "camel-binding" quickstart in our distribution demonstrates this capability.  I would try hacking up that example to meet your requirement and if something is missing then let us know.

          • 2. Re: Migration jboss ESB to switchYard file binding
            hamid1982

            Thank you Keith for your replay.

             

            The "camel-binding" quickstart is working perfectly. I have done some modification to switchyard.xml to add a specific patter to files i want to pull from the directory. Below the content of switchyard.xm:

             

            <?xml version="1.0" encoding="utf-8" ?>

            <switchyard xmlns="urn:switchyard-config:switchyard:1.0"

                xmlns:file="urn:switchyard-component-camel-file:config:1.0"

                xmlns:camel="urn:switchyard-component-camel:config:1.0"

                xmlns:jms="urn:switchyard-component-camel-jms:config:1.0">

             

             

                <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">

             

                    <service name="GreetingService" promote="GreetingService">

                        <file:binding.file>

                            <file:directory>C:/filetest</file:directory>

                            <file:consume>

                               <file:initialDelay>50</file:initialDelay>

                               <file:delay>50</file:delay>

                               <file:delete>true</file:delete>

                               <file:recursive>true</file:recursive>

                               <file:include>(.)*(_in_)(.)*\.(xml\.ok)</file:include>

                            </file:consume>

                        </file:binding.file>

                    </service>

                </composite>

            </switchyard>

             

            The problem I have now is that when I deploy the example in jboss server 7 (AS7-switchyard-0.6). files are not pulled from the directory (C :/ filetest).

             

            Is there any configuration missins in standlone.xml or others files configurations?

             

            My need is that, when server is started, the example remain listening on C :/ filetest and when we put a file in the directory, it is pulled from source directory.

             

            I have deployed the example as jar file with JBoss Developer Studio Version: 6.0.0.GA

             

             

            Best Regards.

             

            Ce message a été modifié par: Hamid RAHMOUNI

            • 3. Re: Migration jboss ESB to switchYard file binding
              splatch

              Hey Hamid,

              I tested similar binding with 0.7.0.Final under Windows 7 and it works well. Please try without include expression first.

               

              Best regards,

              Lukasz

              • 4. Re: Migration jboss ESB to switchYard file binding
                hamid1982

                Hi Lukasz, thanks for the replay

                 

                I tried with this configuration below :

                 

                <?xml version="1.0" encoding="utf-8" ?>

                <switchyard xmlns="urn:switchyard-config:switchyard:1.0"

                    xmlns:file="urn:switchyard-component-camel-file:config:1.0"

                    xmlns:camel="urn:switchyard-component-camel:config:1.0"

                    xmlns:jms="urn:switchyard-component-camel-jms:config:1.0">

                 

                 

                    <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">

                       

                        <service name="GreetingService" promote="GreetingService">

                            <file:binding.file>

                                <file:directory>C:/filetest</file:directory>

                                <file:fileName>test.txt</file:fileName>

                                <file:consume>

                                   <file:initialDelay>50</file:initialDelay>

                                   <file:delay>50</file:delay>

                                   <file:delete>true</file:delete>

                                   <file:recursive>true</file:recursive>

                                </file:consume>

                            </file:binding.file>

                        </service>

                    </composite>

                </switchyard>

                 

                the example work fine when i launch  the CamelBindingTest Class. But, when i add the project to jboss server (AS7-switchyard-0.6) and launch the server. The file test.txt is not pulled from the directory. Have you any idea why in this case when don't get the same behavior ?

                 

                Best regards.

                • 5. Re: Migration jboss ESB to switchYard file binding
                  kcbabo

                  A few things to check in order:

                   

                  1) Make sure the deployment was actually successful.  If you look in the standalone/deployments directory, you should see a marker file with the name of your application jar with ".deployed" at the end of it.

                  2) Watch the the console during deployment/startup to see if there are any issues reported.

                  3) Did the "filetest" directory exist before deploying the app?  If not, make sure it's being created when the app is deployed (this should happen automatically).  If the directory existed prior, make sure that a ".camel" directory has been created inside the directory (indicating that Camel is polling that dir).

                  4) Turn on DEBUG logging for "org.switchyard" and "org.apache.camel" in standalone/configuration/standalone.xml. You'll need to add these logger definitions - just follow the examples already in there.  Be sure to set the console-handler level to DEBUG if you want to see the output on console.

                  1 of 1 people found this helpful
                  • 6. Re: Migration jboss ESB to switchYard file binding
                    splatch

                    Hey Hamind,

                    I see now where problem exactly is. You use dedicated namespace for file binding which is available since 0.7 but you deploy on 0.6. If you would like to run the configuration above change prefix for file binding from file: to camel:.

                     

                    Best regards,

                    Lukasz

                    • 7. Re: Migration jboss ESB to switchYard file binding
                      hamid1982

                      Hi Lukasz,

                       

                      Indeed, this is the real cause of the problem ! it works perfectly now. thank you very much

                       

                      Best Regards.