1
votes

I've given my mule config below and I use mule 3.4.0. When my activemq goes down the ftp endpoint reads the inbound files and tries to start the jms connector and I get the follwing error. JMS reconnect doesnt happen until I restart mule. Please help. Thanks

INFO 2013-10-09 13:14:53,925 [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@43162] org.mule.exception.DefaultSystemExceptionStrategy: Exception caught is a ConnectException, attempting to reconnect... INFO 2013-10-09 13:14:53,925 [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@43162] org.mule.lifecycle.AbstractLifecycleManager: Stopping connector: ActiveMQJMSConnector INFO 2013-10-09 13:14:53,948 [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@43780] org.mule.exception.DefaultSystemExceptionStrategy: Exception caught is a ConnectException, attempting to reconnect... ERROR 2013-10-09 13:14:53,949 [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@43162] org.mule.exception.DefaultSystemExceptionStrategy: Failed to start Jms Connection ERROR 2013-10-09 13:14:53,949 [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@43780] org.mule.exception.DefaultSystemExceptionStrategy: Already in lifecycle phase 'stop', cannot fire the same phase twice

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp"
      xmlns:file="http://www.mulesoft.org/schema/mule/file"
      xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
      xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml"
      xsi:schemaLocation="
          http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/3.4/mule-ftp.xsd
          http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.4/mule-file.xsd
          http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.4/mule-jms.xsd
          http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
          http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.4/mule-xml.xsd">
        <mule-xml:namespace-manager includeConfigNamespaces="true"/>
        <ftp:endpoint name="FtpEndpointRecv" host="host1" path="/"
                                  port="21" user="aaa" password="aaa"
                                  pollingFrequency="600000" passive="true" >
        </ftp:endpoint>
        <jms:activemq-connector name="ActiveMQJMSConnector" specification="1.0.2b" brokerURL="tcp://localhost:61616">
                <dispatcher-threading-profile maxThreadsActive="10" maxBufferSize="10" maxThreadsIdle="1" threadTTL="600000" poolExhaustedAction="WAIT" threadWaitTimeout="10000"/>
            <reconnect-forever frequency="5000"/>
    </jms:activemq-connector>
        <file:file-to-string-transformer name="FileToStringTransformer"/>
        <flow name="ftptojms">
                <ftp:inbound-endpoint ref="FtpEndpointRecv" transformer-refs="FileToStringTransformer">
                        <file:filename-wildcard-filter pattern="*.xml"/>
                </ftp:inbound-endpoint>
                <all>
                        <logger level="INFO" message="#['Payload is:'+payload+'\nInbound Headers: '+message.inboundProperties.entrySet()+'\nOutbound Headers: '+message.outboundProperties.entrySet()+'\nExceptions: '+exception]"/>
                        <file:outbound-endpoint responseTimeout="10000" outputPattern="#[message.inboundProperties.originalFilename]" path="/test/msgcopy/"/>
                        <processor-chain>
                                <message-properties-transformer>
                                        <add-message-property key="sourceFile" value="#[message.inboundProperties.originalFilename]"></add-message-property>
                                        <add-message-property key="sourceDir" value="test"></add-message-property>  
                                </message-properties-transformer>
                                <jms:outbound-endpoint queue="testQ" connector-ref="ActiveMQJMSConnector"></jms:outbound-endpoint>
                        </processor-chain>
                </all>
        </flow>
</mule>
1

1 Answers

0
votes

Starting/stopping endpoints in case of errors, is not a typical pattern used in Mule.

Instead use a message processor like until-successful to keep retrying the jms:outbound-endpoint interaction until it succeeds.