MQ Message Object Output

I have configured the IBM websphere mq in my virtual asset. My Input is BytesMessage, but Object Message Responder does not exist for virtualization incoming request. Which Message Responder should I choose?
I need convert input to Map<String, String>, then convert to BytesMessage after edit.What can I do for it?

Answers

  • williammccuskerwilliammccusker Posts: 453 ✭✭✭

    Hi,

    The BytesMessage should be read and converted to a string by the responder. Are the bytes of the message XML or JSON or just a literal value? You could start with a literal responder and monitor the asset to see what message the responder receives.

  • danielzhoudanielzhou Posts: 3
    edited January 8

    Hi williammccusker
    When I start with a literal responder and run java in Extension Tool, error "Failed an attempt to report a request message" has happened.

    String byte2String(Object input, ScriptingContext context) {
        return input;
    }
    
  • williammccuskerwilliammccusker Posts: 453 ✭✭✭

    Hi,

    That code indicates the method should return a string however the variable input is an Object. What happens if you call "toString" on the input to make sure what it returns is in fact a String?

  • danielzhoudanielzhou Posts: 3

    Hi,

    input is in fact a String. I take the Extension Tool in a response.

  • williammccuskerwilliammccusker Posts: 453 ✭✭✭

    Hi,

    Do you have any more details from the error message? Using Event monitoring often gives more insight into what the error might be. From looking at the code example provided, if it is in fact Java, I would have expected a compile error since Java should force the code to explicitly cast the "input" to a String for the return. A scripting language like Groovy would not have a problem with that code.

Sign In or Register to comment.