6 Replies Latest reply on Mar 25, 2013 4:08 PM by splatch

    Switchyard DDS Binding

    hnqoliveira

      I need create a service that listen a DDS (Data Distribution Service) Topic and call an external webservice.

      How can I do it ?

       

      Obs: The component CamelOS (http://dev.opensplice.org/cgi-bin/twiki/view/Community/CAMELOSDocumentation) allow the integration between Camel and DDS.

      Thanks

        • 1. Re: Switchyard DDS Binding
          splatch

          Hey Henrique,

          You can use 'camel:binding.uri' element and it's attribute configUri to stick with DDS service. Please reffer camel binding documentation. You may also need a module definition. Good examples you will find in our release repository. For exampel quartz module definition is really small.

           

          Cheers,

          Lukasz

          1 of 1 people found this helpful
          • 2. Re: Switchyard DDS Binding
            kcbabo

            Magesh created an article some time back about packaging up Camel components for AS 7 and making them available to the SY runtime:

            https://community.jboss.org/wiki/SwitchYardAS7CamelIntegration

             

            Lukasz - not sure if the instructions need to be tweaked slightly after camel modularization.  Looks like it should still work.

            1 of 1 people found this helpful
            • 3. Re: Switchyard DDS Binding
              tnferreira

              Keith,

               

              I created this configuration module but still getting error. My topic class OperationalAlarm is inside a package that already deployed at switchyard.

               

              Caused by: org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[dds://OperationalAlarm:0/br.dds.generated.OperationalAlarm?ReliabilityKind=RELIABLE]. Reason: java.lang.ClassNotFoundException: br.com.embraer.c4i2sr.commons.edsf.dds.generated.OperationalAlarm from [Module "org.apache.camel.dds:main" from local module loader @663257b8 (roots: /home/user/switchyard-as7-0.7/modules)]

                        at org.apache.camel.component.dds.DdsProducer.<init>(DdsProducer.java:110)

                        at org.apache.camel.component.dds.DdsEndpoint.createProducer(DdsEndpoint.java:482)

                        at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:385)

                        ... 74 more

              Caused by: java.lang.ClassNotFoundException: br.dds.generated.OperationalAlarm from [Module "org.apache.camel.dds:main" from local module loader @663257b8 (roots: /home/user/switchyard-as7-0.7/modules)]

                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                        at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_27]

                        at java.lang.Class.forName(Class.java:169) [rt.jar:1.6.0_27]

                        at org.apache.camel.component.dds.DdsProducer.<init>(DdsProducer.java:108)

               

              -------------------------

               

              <module xmlns="urn:jboss:module:1.0" name="org.apache.camel.dds">

                    <resources>

                      <resource-root path="camel-dds-0.2-SNAPSHOT.jar"/>

                      <resource-root path="dcpssaj.jar"/>

                  </resources>

                 <dependencies>

                      <module name="org.slf4j"/>

                                    <module name="org.omg.api"/>

                                    <module name="org.apache.commons.logging"/>

                      <module name="org.apache.camel.core"/>

                  </dependencies>

              </module>

               

              My code:

              public void configure() {

                        from("switchyard://Alert")

                        .process(new Processor() {

                                  @Override

                                  public void process(Exchange exchange) throws Exception {

                                            Message m = exchange.getIn().getBody(Message.class);

               

                                            System.out.println("Routing !!!!");

               

                                            OperationalAlarm h = new OperationalAlarm();

                                            h.msg = " Camel = "  + m.getValue();

                                            exchange.getIn().setBody(h);

                                            System.out.println("Processor ok !!!!");

                                  }

                        }).log("camel : ${body}")

                        .to("dds:OperationalAlarm:0/br.dds.generated.OperationalAlarm?ReliabilityKind=RELIABLE");

               

               

               

              What am I doing wrong ?

               

              Cheers

              Thiago

              • 4. Re: Switchyard DDS Binding
                splatch

                Could you take a look on this topic? I made camel-saxon working in similar way. However your stack trace suggest that org.apache.camel.dds has missing dependencies. Are you sure that br.dds.generated.OperationalAlarm is part of this module JARs?

                • 5. Re: Switchyard DDS Binding
                  tnferreira

                  It's works. Thank you Łukasz.

                   

                  Now, I have the follow problem:

                  1) Receive a HTTP request with the Alarm object (ok - working)

                  2) Transform the object (ok - working)

                  3) Publish Alarm object on DDS (ok - working)

                  4) Wait for a AlarmAck object from DDS (how I do that ???)

                  5) Transform object to xml with OK and Id or NOK.

                  6) Response the HTTP request with the XML.

                   

                  Probably ExchangePattern:InOut is the way, but there's only examples with JMS on Camel website.

                   

                  I want to integrate/transform Pub/Sub legacy system to Resquest/Reply on the Web.

                   

                  Could anyone help me with this ?

                  • 6. Re: Switchyard DDS Binding
                    splatch

                    Hey Thiago,

                    I am happy that you made camel DDS working together with SwitchYard. Camel-DDS is not most popular component I saw, so I can not help you much more than I did. However if you would like to receive an alarm from DDS then you simply need to "consume" incoming messages. To achieve that you may need add service binding.

                     

                    <?xml version="1.0" encoding="UTF-8"?>
                    <switchyard xmlns="urn:switchyard-config:switchyard: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="AlarmService" promote="AlarmService">
                                <binding.uri configUri="dds://topic-name" xmlns="urn:switchyard-component-camel-core:config:1.0"/>
                            </service>
                            <component name="AlarmService">
                                <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0" class="my.packagename.AlarmServiceImpl"/>
                                <service name="AlarmService">
                                    <interface.java interface="my.packagename.AlarmService"/>
                                </service>
                            </component>
                        </composite>
                    </switchyard>