Question

Please help me on this logic. I have to call the service and get the response back.If the service is down or something have to retry 3 times and once exhausted need to log in DLQ.I'm using until successful processor.For success scenario i'm getting only null payload in logger.But i tried keeping the HTTP outbound end point without until successfull able to get the response from the service. Please find my xml config.

              <flow name="Flow" doc:name="eFlow" tracking:enable-default-events="true">
                     <wmq:inbound-endpoint queue="InputQ" tracking:enable-default-events="true" connector ref="WMQ_Connector" doc:name="connector">
                 <wmq:transaction action="NONE"/>
              </wmq:inbound-endpoint>
                  <mulexml:dom-to-xml-transformer></mulexml:dom-to-xml-transformer>
                     <set-session-variable variableName="originalPayload" value="#[payload]"       doc:name="Store_Payload"/>
                <choice tracking:enable-default-events="true" doc:name="Choice">
              <when expression="#[xpath('fn:local-name(/root/*[2])') == 'Master']">
                         <data-mapper:transform config-ref="Master_grf" doc:name="Master"/>
                    </when>
             <when expression="#[xpath('fn:local-name(/root/*[2])') == 'Request']">
        <data-mapper:transform config-ref="Request_grf" doc:name="Bulk"/>
             </when>
                    <otherwise>
            <scripting:component doc:name="Throw_Exception">
              <scripting:script engine="Groovy"><![CDATA[throw new IllegalArgumentException  ('requests invalid') ]]>
           </otherwise>
                    </choice>
               <mulexml:dom-to-xml-transformer></mulexml:dom-to-xml-transformer>
               <flow-ref name="Invoke_Service" doc:name="Flow Reference"/>
              </flow>


                <flow name="Invoke_Service" doc:name="Invoke_Service" tracking:enable-default-events="true">
     <cxf:jaxws-client  enableMuleSoapHeaders="true" doc:name="SOAP" operation="Request" serviceClass="com.valid.ICase"/>
       <until-successful objectStore-ref="objectStore" maxRetries="3" secondsBetweenRetries="2"  deadLetterQueue-ref="VM" doc:name="UntilSuccessful_SymboticService">
       <http:outbound-endpoint exchange-pattern="request-response"    method="POST" doc:name="HTTP" address="http://localhost:1112/symbotic"/>
          </until-successful>  
       <byte-array-to-string-transformer doc:name="Byte Array to String"/>
    <logger message="**********success***Payload: #[payload]*****" level="INFO" doc:name="Logger"/>

But incase of failure scenario until success retry 3 times ( works fine). I have tried request reply processor inside until also transactional processor. It is not working. Using Mule version 3.4.kindly suggest me.

Retried the same with request -reply processor as per the suggestion

      <flow name="Flow" doc:name="eFlow" tracking:enable-default-events="true">
             <wmq:inbound-endpoint queue="InputQ" tracking:enable-default-events="true" connector-           ref="WMQ_Connector" doc:name="connector">
    <wmq:transaction action="NONE"/>
    </wmq:inbound-endpoint>
           <mulexml:dom-to-xml-transformer></mulexml:dom-to-xml-transformer>
        <set-session-variable variableName="originalPayload" value="#[payload]" doc:name="Store_Payload"/>
         <choice tracking:enable-default-events="true" doc:name="Choice">
    <when expression="#[xpath('fn:local-name(/root/*[2])') == 'Master']">
        <data-mapper:transform config-ref="Master_grf" doc:name="Master"/>
    </when>
    <when expression="#[xpath('fn:local-name(/root/*[2])') == 'Request']">
        <data-mapper:transform config-ref="Request_grf" doc:name="Bulk"/>
    </when>
 <otherwise>
        <scripting:component doc:name="Throw_Exception">
            <scripting:script engine="Groovy"><![CDATA[throw new IllegalArgumentException('requests           other then Master andRequest') ]]>
    </otherwise>
 </choice>
  <mulexml:dom-to-xml-transformer></mulexml:dom-to-xml-transformer>
  <request-reply timeout="10000">
 <vm:outbound-endpoint path="request"/>      
    <vm:inbound-endpoint path="reply"/>
   </request-reply> 
  <byte-array-to-string-transformer doc:name="Byte Array to String"/>
<logger message="**********success***Payload: #[payload]*****" level="INFO" doc:name="Logger"/>     
  </flow>

  <flow name="Invoke_Service" doc:name="Invoke_Service" tracking:enable-default-events="true">
<vm:inbound-endpoint path="request" doc:name="VM"/>
 <cxf:jaxws-client  enableMuleSoapHeaders="true" doc:name="SOAP" operation="Request"    serviceClass="com.valid.ICase"/>
   <until-successful objectStore-ref="objectStore" maxRetries="3" secondsBetweenRetries="2"  deadLetterQueue-ref="VM" doc:name="UntilSuccessful_Service">
   <http:outbound-endpoint exchange-pattern="request-response"    method="POST" doc:name="HTTP" address="http://localhost:1112/symbotic"/>
   </until-successful> 
   </flow>

Even then getting the null payload. Kindly suggest is this is the way your were directing me. Please correct me if im wrong.

Was it helpful?

Solution

until-successful is an asynchronous processor. It does not return response from service call.

Success or failure are defined as:

  1. If the child message processor throws an exception, this is a failure.
  2. If the child message processor does not return a message (e.g. is a one-way endpoint), this is a success.
  3. If a 'failure expression' (see below) has been configured, the return message is evaluated against this expression to determine failure or not.
  4. Otherwise:
    1. If the child message processor returns a message that contains an exception payload, this is a failure.
    2. If the child message processor returns a message that does not contain an exception payload, this is a success.

http://www.mulesoft.org/documentation/display/current/Routing+Message+Processors#RoutingMessageProcessors-UntilSuccessful

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top