jsonmuledataweavetibco-ems

Transform EMS Queue message and insert into DB using Anypoint Studio


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!


Solution

  • 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" >