3 Replies Latest reply on Sep 2, 2010 2:15 PM by eric_bustad

    JBoss transactional web service

    eric_bustad

      I am trying to setup two services under JBossESB, one of which receives a SOAP message from a client, generates a XML file, and passes that to the second service.  The second service is responsible for sending that XML file to a remote non-ESB aware web service.   These two services are connected by a queue.

       

      I would like the process of the second service taking a message off the queue and sending it to the remote web service to be a single transaction.

      If any of the actions in the service throws an exception, I would want the message to be left on the queue and redelivery attempted after a delay.

       

      I have tried to model this after the jms_transacted quickstart.  However, it seems that the message is not left on the queue after a failure of the second service and, so, no redelivery is attempted.

       

      I had thought that specifying the transacted="true" attribute on the <jms-message-filter> element and the use of <jms-jca-provider> would accomplish this, but obviously not.  Or I an doing something else wrong?

       

      I am using jbossesb-server-4.7, which came with JBoss Messaging rather than JBossMQ.

      Below is a redacted version of my jboss-esb.xml file:

       

      <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd ..\..\..\docs\schema\jbossesb-1.2.0.xsd"

      <globals>
      <war-security method="BASIC" domain="JBossWS" />
      </globals>

       

         <providers>
            <http-provider name="http">
               <http-bus busid="secureFriends">
                  <allowed-roles>
                     <role name="friend"></role>
                  </allowed-roles>
                  <protected-methods>
                     <method name="GET"/>
                     <method name="POST"/>
                  </protected-methods>
               </http-bus>
               <exception mappingsFile="/http-exception-mappings.properties"></exception>
            </http-provider>
            <jms-jca-provider name="JBossMessaging" connection-factory="ConnectionFactory">
               <jms-bus busid="queueZ">
                  <jms-message-filter dest-type="QUEUE" dest-name="queue/Z" transacted="true"/>
               </jms-bus>
               <activation-config>
                  <property name="dLQMaxResent" value="111"/>
               </activation-config>
            </jms-jca-provider>
         </providers>

       

         <services>

            <service category="PLMWebServices" name="PLMExport" invmScope="GLOBAL" description="Export PLM objects in XML format to a target system">

               <property name="maxThreads" value="1"/>
               <listeners>
                  <http-gateway name="http" busidref="secureFriends">
                     <property name="synchronousTimeout" value="220000"/>
                  </http-gateway>
               </listeners>

       

               <actions mep="RequestResponse" faultXsd="/fault.xsd" inXsd="/request.xsd" outXsd="/response.xsd">

                  <action name="dmsExport"/>

                  <action name="sendToTargets">
                     <property name="destinations">
                        <route-to service-category="PLMInternal" service-name="TargetTransport"/>
                     </property>
                  </action>

               </actions>
            </service>


            <service category="PLMInternal" name="TargetTransport" description="Transport Service for target">
               <property name="maxThreads" value="1">1</property>
               <listeners>
                  <jms-listener name="queueZ" busidref="queueZ" />
               </listeners>
               <actions mep="OneWay">

                  <action name="send2import">
                     <property name="endpointUrl" value="https://remotehost:8443/PLMImport">
                        <http-client-property name="file" value="/PLMImport-http.properties" />
                     </property>
                     <property name="method" value="POST"/>
                     <property name="responseType" value="STRING"/>
                  </action>

               </actions>
            </service>
         </services>
      </jbossesb>

        • 1. Re: JBoss transactional web service
          eric_bustad

          Digging though the logs, it seems possible to me that my use of InVM transport for the first service is causing the message to be sent to the second also using InVM, bypassing the JCA transaction processing.   Could this be the problem?

          • 2. Re: JBoss transactional web service
            eric_bustad

            OK, that was not the problem.  I have now found that if an action throws an IllegalStateException, then the message is redelivered to the service after the proper delay.  But throwing an ActionProcessingException will not.  Is this how it is supposed to work?

            • 3. Re: JBoss transactional web service
              eric_bustad

              But an IllegalStateException is caught when thrown from a processException method while the action pipeline is working its way backwards after an ActionProcessingException was thrown from a later action.  So I cannot do my own cleanup for a transactional  service?