2

I am trying to listen and consume an EMS queue message and transform it to insert into a Database using Anypoint Studio platform.

Below youn can find an example of the EMS queue message, and the structure of the target database table, as well as, the error I am getting, I cannot find anything to help me with this and would appreciate any insight on how to solve it! Thank you!

EMS Queue message: 1 Lopez, Gerardo 22/07/1994 323 Corona, San Pedro, Mexico 8177228822

Target DB Table Columns: id, first_name, last_name, birth_date, street, city, country, phone I need to insert the appropriate data in the corresponding column and transform all characters to lower case, below you can find what I am doing right not and the error I get!

Process

Transform Message Detail

Console Output

Caused by: org.mule.weave.v2.module.reader.ReaderParsingException: Unexpected character 'G' at payload@[1:4] (line:column), expected Expecting end of input but got G, while reading payload` as Json.

The same message repeats for all EMS Queue messages!

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43

1 Answers1

0

I guess that EMS means TIBCO EMS. It looks that the application is receiving a message from the TIBCO EMS queue, which is the string:

16 Gonzalez, Martin...

For some reason, DataWeave is trying to parse it like a JSON document. That is clear in the error. It fails in the G because the beginning is a number, so the parser for JSON wasn't expecting a G character there. A number by itself would be a perfectly valid JSON document.

You'll have to set the correct format for the input. If the TIBCO EMS connector is receiving the application/json from the message, it should be changed from the sending side.

If you need to force the format you can use set payload though I don't recommend to force it unless there is no other choice:

<set-payload value="#[payload]" mimeType="text/plain" >
aled
  • 21,330
  • 3
  • 27
  • 34
  • Yes, it is TIBCO EMS and I have the JMSSendMessage with Message Type as Text, so it makes me thinkg I need to force it, but I am not sure on where to add the code you provided! I am very new with using the technology – Gerardo Lopez Aug 10 '20 at 18:02
  • 1
    Just add it between the listener and the transformation. If you are more comfortable with the UI search for the set payload component in the palette. – aled Aug 10 '20 at 18:31