Mule SQS sendMessage throwing Failed to transform from "json" to "java.util.HashMap"

Chris

After upgrading to latest SQS connector previously working code now fails.

  • Mule ESB and Integration Platform Version: 3.6.0 Build: ed775fdb
  • Amazon SQS Connector (Mule 3.5.0+) 3.0.0.201506091134

The latest version of the connector requires the message attribute to be specified.

API doc's show message should be a String. http://mulesoft.github.io/sqs-connector/3.0.0/mule/sqs-config.html#send-message

Using:

<object-to-string-transformer doc:name="Object to String"/>

The flow takes the posted data and submits it as a SQS message.

<flow name="rxWebhook">
    <http:listener config-ref="HTTPS_8081" path="/" doc:name="HTTPS" responseStreamingMode="ALWAYS">
        <http:response-builder disablePropertiesAsHeaders="true"/>
    </http:listener>
    <object-to-string-transformer doc:name="Object to String"/>
    <sqs:send-message config-ref="Amazon_SQS_USWEST2" message="#[payload]" queueUrl="${aws.sqs.myQueue}" doc:name="Amazon SQS"/>
</flow>

When posting json data to the flow it errors with:

org.mule.api.transformer.TransformerMessagingException: Failed to transform from "json" to "java.util.HashMap". Message payload is of type: String

Ryan Carter

I think it's because theres i an optional parameter named:

<sqs:message-attributes>

Which defaults to #[payload] and expects the payload to be a Map. So to avoid this, specify the param and try passing null maybe:

<sqs:send-message config-ref="Amazon_SQS_USWEST2" message="#[payload]" queueUrl="${aws.sqs.myQueue}" doc:name="Amazon SQS">
            <sqs:message-attributes ref="#[null]"/>
</sqs:send-message>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Failed to convert value of type java.util.HashMap to String

Firebase "Failed to convert a value of type java.util.HashMap to int"

How to populate java.util.HashMap on the fly from Scala code?

JSON transform in Mule 3

Mule transform JSON to Map

Android - Firebase - Failed to convert value of type java.util.HashMap to String

Firestore Could not deserialize object. Failed to convert value of type java.util.HashMap to Date

Android Firebase Failed to convert value of type java.util.HashMap to String

Failed to convert value of type java.util.HashMap to String. Converting string to map

Failed to convert value of type java.util.HashMap to String but no hashmap in code?

Is it safe to get values from a java.util.HashMap from multiple threads (no modification)?

Vaadin 12, javaScript: java.lang.IllegalArgumentException: Can't encode class java.util.HashMap to json

Converting java.util.HashMap to JSON in Scala after serializing/deserializing Avro Record

How to convert from java.util.HashMap to android.content.ContentValues?

SQS sendMessage latency variation?

Testing async SQS sendMessage

Transform Json array without key to SOQL format in mule

init method in java.util.hashMap

Convert Kotlin MutableMap to java.util.HashMap

Intellij deprecation warning for java.util.HashMap

Internal implementation of java.util.HashMap and HashSet

In java.util.HashMap, why modcount is not a boolean?

java.util.HashMap missing in PySpark session

java.util.HashMap cannot be cast to Object

Extracting key Value from Json - Mule Dataweave

Filter an Array of Json From Mule Dataweave

mule getting data from json payload

Mule dataweave extract elements from json array

Get JSON Object from AWS SQS Event