0
votes

In proxy i have this to send to rabbitMQ:

         <property name="messageType" value="text/xml" scope="default"/>
         <property name="contentType" value="text/xml" scope="default"/>
         <property name="rabbitmq.attributes.app.id"
                   value="RMIS"
                   scope="axis2"
                   type="STRING"/>
         <property name="rabbitmq.attributes.type"
                   value="BRANCH"
                   scope="axis2"
                   type="STRING"/>
         <property name="rabbitmq.attributes.user.id"
                   value="RMIS"
                   scope="axis2"
                   type="STRING"/>
         <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
         <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
         	mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
         <property name="rabbitmq.attributes.custom.message.id"
                   expression="get-property('RABBIT_MESSAGE_ID')"
                   scope="axis2"/>
         <clone continueParent="true">
            <target sequence="writeToFile"/>
         </clone>
         <send>
            <endpoint key="rabbit"/>
         </send>

in ENDPOINT:

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="rabbit">
   <address uri="rabbitmq://writeToQueue?rabbitmq.server.host.name=localhost&rabbitmq.server.port=5672&rabbitmq.server.user.name=guest&rabbitmq.server.password=guest&rabbitmq.queue.name=queque" format="soap11">
      <suspendOnFailure>
         <progressionFactor>1.0</progressionFactor>
      </suspendOnFailure>
      <markForSuspension>
         <retriesBeforeSuspension>0</retriesBeforeSuspension>
         <retryDelay>3000</retryDelay>
      </markForSuspension>
      <timeout>
         <responseAction>fault</responseAction>
      </timeout>
   </address>
</endpoint>
                        

but I catch an error, when i send it to rabbitMQ Server:

TID[-1234] [ESB] [2016-06-03 16:32:06,479] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Unexpected error during sending message out
org.apache.axis2.transport.rabbitmq.RabbitMQMessage.(RabbitMQMessage.java:43)
org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendOverAMQP(RabbitMQSender.java:84)
org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:72)
org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542)
org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:461)
org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:372)
org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:55)
org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:105)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)

The log in WSO2 ESB there: And i don't understand, why can not contact with rabbitMQ. In rabbitMQ also, i don't catch any error. ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:247) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:91) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:461) at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:372) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:105) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.apache.axis2.transport.rabbitmq.RabbitMQMessage.&lt;init&gt;(RabbitMQMessage.java:43) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendOverAMQP(RabbitMQSender.java:84) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:72) at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79) ... 15 more

new stackTrace: `[2016-06-27 17:07:00,380] ERROR - Axis2Sender Unexpected error during sending message out java.lang.IllegalStateException: Invalid configuration: 'routingKey' must be non-null. at com.rabbitmq.client.impl.AMQImpl$Basic$Publish.(AMQImpl.java:2278) at com.rabbitmq.client.AMQP$Basic$Publish$Builder.build(AMQP.java:1219) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:647) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:630) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:621) at org.apache.axis2.transport.rabbitmq.RabbitMQMessageSender.send(RabbitMQMessageSender.java:252) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendOverAMQP(RabbitMQSender.java:85) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:72) at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:461) at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:372) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65) at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:55) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:105) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) [2016-06-27 17:07:00,386] WARN - FaultHandler ERROR_CODE : 0 [2016-06-27 17:07:00,386] WARN - FaultHandler ERROR_MESSAGE : Unexpected error during sending message out [2016-06-27 17:07:00,387] WARN - FaultHandler ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:247) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:91) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:461) at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:372) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65) at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:55) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:105) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalStateException: Invalid configuration: 'routingKey' must be non-null. at com.rabbitmq.client.impl.AMQImpl$Basic$Publish.(AMQImpl.java:2278) at com.rabbitmq.client.AMQP$Basic$Publish$Builder.build(AMQP.java:1219) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:647) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:630) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:621) at org.apache.axis2.transport.rabbitmq.RabbitMQMessageSender.send(RabbitMQMessageSender.java:252) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendOverAMQP(RabbitMQSender.java:85) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:72) at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79) ... 16 more

[2016-06-27 17:07:00,388] WARN - FaultHandler ERROR_EXCEPTION : org.apache.synapse.SynapseException: Unexpected error during sending message out [2016-06-27 17:07:00,388] WARN - FaultHandler FaultHandler : Endpoint [rabbit] [2016-06-27 17:07:00,388] WARN - EndpointContext Endpoint : rabbit will be marked SUSPENDED as it failed`

1
Is this the full stacktrace? It seems like the root exception is missing.Amila Maharachchi
yes. It is full stacktrace from wso2 ESB UIMitchell Cameron
Pls check the log file in the file system, if you have access to. It might have more info in the logs.Amila Maharachchi
Sorry. Its not the one I was looking for.Amila Maharachchi
maybe this log? full stacktraceMitchell Cameron

1 Answers

4
votes

Add following properties to insequence of Proxy.

<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>

Then your configurations should be like follow:

     <property name="messageType" value="text/xml" scope="default"/>
     <property name="contentType" value="text/xml" scope="default"/>
     <property name="OUT_ONLY" value="true"/>
     <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
     <property name="rabbitmq.attributes.app.id"
               value="RMIS"
               scope="axis2"
               type="STRING"/>
     <property name="rabbitmq.attributes.type"
               value="BRANCH"
               scope="axis2"
               type="STRING"/>
     <property name="rabbitmq.attributes.user.id"
               value="RMIS"
               scope="axis2"
               type="STRING"/>
     <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
     <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
        mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
     <property name="rabbitmq.attributes.custom.message.id"
               expression="get-property('RABBIT_MESSAGE_ID')"
               scope="axis2"/>
     <clone continueParent="true">
        <target sequence="writeToFile"/>
     </clone>
     <send>
        <endpoint key="rabbit"/>
     </send>

According to new stackTrace, it is mention about "'routingKey' must be non-null."

Please add "rabbitmq.exchange.name" parameter and relevant value for that.

Ex:

<endpoint>
     <address
     uri="rabbitmq:/AMQPProxy?rabbitmq.server.host.name=192.168.0.3&rabbitmq.server.port=5672&rabbitmq.server.user.name=user&rabbitmq.server.password=abc123&rabbitmq.queue.name=queue2&rabbitmq.exchange.name=exchange2"/>
  </endpoint>

If you need further clarification, please refer WSO2 docs: https://docs.wso2.com/display/ESB490/RabbitMQ+AMQP+Transport