1 2 Previous Next 18 Replies Latest reply on Apr 9, 2013 5:14 AM by yperey Go to original post
      • 15. Re:
        koljamaertens

        First of all: Sorry for digging this out again. I am facing a similar problem:

        I use an existing Spring Dao to retrieve a List of Objects from an application.

        I converted this List to XML using XStream and now I want to split it into single objects for further processing on the ESB.

         

        The example John provided seems simple enough, but I was hoping I could get around the whole JMS "stuff" thats included in the attached example project.

        So I added a smooks transformation as last action to the Service that retrieves and converts the Data, just like John posted above.

        The real problem starts when building the Service that is supposed to receive the messages from the splitting transformation.

         

        I tried to build a supersimple service, just to see if it is invoked once for every single Object in the first XML, so I added nothing but a Println Action.

         

        I am getting the following error:

         

        Deployment "jboss.esb.vfsfile:/C:/Programme/jboss-soa-p-5/jboss-as/server/default/deploy/myStuff.esb/" is in error due to the following reason(s): org.jboss.soa.esb.ConfigurationException: Service configuration for Service 'InvoiceProcessing:IndividualInvoiceProcessor' doesn't define a Message-Aware Listener (i.e. is-gateway='false').

         

        What kind of Listener would be suitable if I just want the Service to listen for messages that origin from smooks?

         

        Cheers

        kolja

        • 16. Re:
          svejk

          Kolja Märtens wrote:

           

          ...

          I am getting the following error:

           

          Deployment "jboss.esb.vfsfile:/C:/Programme/jboss-soa-p-5/jboss-as/server/default/deploy/myStuff.esb/" is in error due to the following reason(s): org.jboss.soa.esb.ConfigurationException: Service configuration for Service 'InvoiceProcessing:IndividualInvoiceProcessor' doesn't define a Message-Aware Listener (i.e. is-gateway='false').

           

          What kind of Listener would be suitable if I just want the Service to listen for messages that origin from smooks?

           

          Cheers

          kolja

           

          If you don't need or want a JMS-listener, or any other "heavy-weight" listener, on your service,

          you should be able to get by with just an invm-listener. Adding an invm-listener is done by overriding the

          attribute invmScope (which default to the value "NONE") on your service definition in META-INF/jboss-esb.xml.

          E.g:

           

          <services>

              ...

             <service name="..." description="..." category="..."

                          invmScope="GLOBAL">

              ...

           

          Note: You should be careful with InVM transport if you have high requirements on robustness and fail-over in

          your service.  See also the section on the InVM transport in the Programmer's Manual:   http://docs.jboss.org/jbossesb/docs/4.9/manuals/html/Programmers_Guide/index.html#d0e1285

           

           

          Regards,

           

          Sven-Jørgen Karlsen

          • 17. Re:
            tfennelly

            There's a Basic Splitting option in Smooks v1.4 (see docs here).  So to use it, you'll need to patch the version of Smooks in your esb.

             

            So basically, is just splits out XML fragments from your message an binds them into the Smooks BeanContext, from where you can route them to some endpoint.  There's a Smooks extension in JBossESB for routing to ESB services.

             

            So a few examples (untested) of how to use it...

             

            Routing to a JMS endpoint...

             

            <?xml version="1.0"?>
            <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
                                  xmlns:frag="http://www.milyn.org/xsd/smooks/fragment-routing-1.2.xsd" 
                                  xmlns:jms="http://www.milyn.org/xsd/smooks/jms-routing-1.2.xsd">
            
                <!-- Create the split messages for each order item... -->
                <frag:serialize fragment="order-items/order-item" bindTo="orderItemFrag" />
            
                <!-- Route each order items split message to the orderItem JMS processing queue... -->
                <jms:router routeOnElement="order-items/order-item" beanId="orderItemFrag" destination="orderItemProcessingQueue" />
            
            </smooks-resource-list>
            

             

            Routing to a JBossESB Service...

             

            <?xml version="1.0"?>
            <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
                                  xmlns:frag="http://www.milyn.org/xsd/smooks/fragment-routing-1.2.xsd" 
                                  xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
            
                <!-- Create the split messages for each order item... -->
                <frag:serialize fragment="order-items/order-item" bindTo="orderItemFrag" />
            
                <!-- Route each order items split message to an ESB Service... -->
                <esbr:routeBean routeOnElement="order-items/order-item" beanIdRef="orderItemFrag" toServiceCategory="OM" toServiceName="orderItemsService" />
            
            
            </smooks-resource-list>
            

             

            Conditional routing to an ESB Service...

             

            <?xml version="1.0"?>
            <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
                                  xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd"
                                  xmlns:frag="http://www.milyn.org/xsd/smooks/fragment-routing-1.2.xsd" 
                                  xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
            
                <!-- Capture some data from each order item… used in routing conditional... -->
                <jb:bean beanId="orderItem" class="java.util.HashMap" createOnElement="order-items/order-item">
                    <jb:value property="quantity" data="order-item/quantity"/>
                    <jb:value property="price" data="order-item/price"/>
                </jb:bean>    
            
                <!-- Create the split messages for each order item... -->
                <frag:serialize fragment="order-items/order-item" bindTo="orderItemFrag" />
            
                <!-- Route order items where value is less than 100... -->
                <esbr:routeBean routeOnElement="order-items/order-item" beanIdRef="orderItemFrag" toServiceCategory="OM" toServiceName="orderItemsService">
                    <condition><!-- orderItem.quantity * orderItem.price <= 100.00 --></condition>
                </esbr:routeBean>
            
            
            </smooks-resource-list>
            
            
            • 18. Re:
              yperey

              Hello Tom,

               

              Thanks for this answer but unfortunately I need to do the same with an old 4.3.0 CP05 SOA platform release only containing the Smooks 1.0.1 version.

               

              Here is what I have currently done, but this is only part of the solution as the TaskItem still need to be populated but how ?

               

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

              <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">

               

                  <resource-config selector="global-parameters">

                      <param name="stream.filter.type">SAX</param>

                  </resource-config>

               

                  <resource-config selector="BMSMESSAGE/TASK">

                      <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>

                      <param name="beanId">TaskItem</param>

                      <param name="serviceCategory">idtv3_esb_CheckNotReadyJobs</param>

                      <param name="serviceName">JobProcessing_Service</param>

                  </resource-config>

               

              </smooks-resource-list>

               

              By the way I cannot find the 1.0 user guide as the following link seems no longer working: http://www.milyn.org/docs/v1.0/SmooksUserGuide_v1.0.html

              1 2 Previous Next