Transaction between VM inbound and JMS outbound

View: New views
3 Messages — Rating Filter:   Alert me  

Transaction between VM inbound and JMS outbound

by Mario Klaver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I need to pass a String message from a VM inbound to a JMS outbound. If the message fails, I need to resend it
to the Queue again. To acheive that, i'm having a custom retry policy in my JMS connector and maintaining a JMS
transaction between the VM inbound and JMS outbound. But the failed message is not getting rolled back.

Could any one please giva a suggestion on how to resend the message again?

mule-config-file:

 <jms:connector
    name="jmsJndiConnector"
    specification="1.1"
    connectionFactory-ref="queueFactory" username="" password="" disableTemporaryReplyToDestinations="true">
      <spring:property name="retryPolicyTemplate" >
       <spring:bean class="com.codebase.service.policy.RetryPolicyCounter">
          <spring:property name="retryCount" value="30"/>
          <spring:property name="delay" value="2000"/>
       </spring:bean>
     </spring:property>
  </jms:connector>

<service name="sendMessage">
      <inbound>
        <vm:inbound-endpoint address="vm://sendMessage">
           <jms:transaction action="ALWAYS_BEGIN"/>
        </vm:inbound-endpoint>
      </inbound>
       <echo-component/>
      <outbound>
        <pass-through-router>
           <jms:outbound-endpoint queue="Queue/destination" connector-ref="jmsJndiConnector" synchronous="false">
                     <custom-transformer name="createResultMap" class="com.codebase.service.transformer.CreateMessage" >
                      <spring:property name="springMarshallerUnMarshaller" ref="requestMarshaller"/>
              </custom-transformer>
              <jms:object-to-jmsmessage-transformer/>
              <jms:transaction action="ALWAYS_JOIN"/>
             </jms:outbound-endpoint>
           </pass-through-router>
      </outbound>
        <default-service-exception-strategy>
            <rollback-transaction exception-pattern="*" />
        </default-service-exception-strategy>
    </service>

Thanks,
Vaithi

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Transaction between VM inbound and JMS outbound

by Mario Klaver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you want to bind VM and JMS in the same transaction then you should be using <xa-transaction>

Retry policy on the connection are for connection retry and not for transaction retry, therefore retry policies will not result in the message being retried.

        <service name="sendMessage">
            <inbound>
                <vm:inbound-endpoint address="vm://sendMessage">
                    <xa-transaction action="ALWAYS_BEGIN"/>
                </vm:inbound-endpoint>
            </inbound>
            <outbound>
                <pass-through-router>
                    <jms:outbound-endpoint queue="Queue/destination">
                        <xa-transaction  action="ALWAYS_JOIN"/>
                    </jms:outbound-endpoint>
                </pass-through-router>
            </outbound>
        </service>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Transaction between VM inbound and JMS outbound

by Mario Klaver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot Puneet.

Retry policies are only for connection retries, that too works only for inbound connections. And by using xa-transaction,
I can rollback the failed message. But once the destination connection is back on service, will the rolled back message
be automatically redelivered or we need to handle it by ourself?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email