to store a message in rabbitmq from mule

爱⌒轻易说出口 提交于 2019-12-07 13:18:27

The payload you're trying to send to Rabbit looks quite complex (sfdc BatchInfo object). How do you except it to be readable for the queue consumer? I think that, for some reason, the message transformers involved in transforming this payload to a byte array suited for AMQP transport fails and you end up trying to send the groovy generated Map with an sfdc BatchInfo object as is to the AMQP client lib.

You should convert the map with contents to a string before sending it to Rabbit. Something like this (call toString on the BatchInfo object and then convert the map to JSON):

Edited (removed outbound properties)

<scripting:transformer doc:name="Groovy">
    <scripting:script engine="Groovy"><![CDATA[return [ batch: payload.toString(), IDs: flowVars['IDs'], batchid: flowVars['batchID'] ]]]></scripting:script>
</scripting:transformer>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<amqp:outbound-endpoint exchangeName="Salesforce-Batch" queueName="batchInfo" exchangeDurable="true" queueDurable="true" responseTimeout="10000" doc:name="AMQP">
    <message-properties-transformer scope="outbound">
        <delete-message-property key="*" />
    </message-properties-transformer>
</amqp:outbound-endpoint>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!