IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to send a nProtobufEvent via the JMS API?

  • 1.  How to send a nProtobufEvent via the JMS API?

    Posted Tue February 21, 2023 11:42 AM

    Hello,

    the Universal Messaging Developer Guide, in the chapter JMS Message / Event Mapping, describes how to interact with UM via the JMS API and vice versa.

    However, I can’t figure out how to publish a nProtobufEvent via the JMS API. My goal is to publish an event from a Java client so that the event can be consumed by the Integration Server.

    If I use the native UM API and create (and send) a nProtobufEvent everything works as desired. But I don’t understand how to accomplish this via JMS.

    I have a protobuf object that I can convert to bytes; I have a JMS connection. And now what?

    If I send the message as a JMS BytesMessage it does not get consumed correctly by the Integration Server.

    I’d be very thankful for any help!


    #Universal-Messaging-Broker
    #webMethods


  • 2.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Thu February 23, 2023 03:03 AM

    What I’ve found out so far is that if I publish a message in Integration Server and receive it in the Java client via JMS, I get it as a BytesMessage (with a UM specific implementing class). Within that object, the field evt is set to an instance of the class nProtobufEvent.

    But how can I do the same if I need to send a message with the JMS API?


    #Universal-Messaging-Broker
    #webMethods


  • 3.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Mon February 27, 2023 05:45 AM

    Could any expert chime in? Or is it something nobody’s done until now? Is it at all a possible usage of the JMS provider (as a sender)?


    #Universal-Messaging-Broker
    #webMethods


  • 4.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Mon February 27, 2023 01:09 PM

    It should be doable… after all the protobuf event is just a byte message with some specific type according to the description here - com.pcbsys.nirvana.client.nProtobufEvent Class Reference. I guess this is what IS does anyway. I suspect it would involve either some cryptic attribute, or manipulating implementation-specific message fields, or some similar forbidden voodoo magic. I’ll see if I can dig something out, but I would not recommend going that way unless you see no other option, since your code will lose on portability.
    I’m sure there’s a good reason but I’ll ask anyway - if you are sending JMS, can’t you consume it with an IS JMS trigger?

    Cheers,
    Stefan


    #Universal-Messaging-Broker
    #webMethods


  • 5.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Mon February 27, 2023 07:44 PM

    The reason is that I want to interact with an existing IS application without modifying it a bit.

    That would be cool!

    I already tried to set all the fields I can to make the message I send look similar to the one I see when a message is received, but apparently I missed something because IS trigger did not fire.


    #webMethods
    #Universal-Messaging-Broker


  • 6.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Mon February 27, 2023 07:51 PM

    I think it is the other way around: a byte message is passed as a special kind of event. After all, UM only knows events. IS sends a nProtobufEvent. If I do this, everything works. But this is the native API, not JMS.


    #Universal-Messaging-Broker
    #webMethods


  • 7.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Tue March 07, 2023 04:32 PM

    Any news on this? I was very happy that I could receive messages via JMS and thus use all of the support by the Spring Framework. It would be pity if I’d need to use the native API for sending (and thus have no Spring support).

    Thank you!


    #Universal-Messaging-Broker
    #webMethods


  • 8.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Wed December 11, 2024 07:20 PM

    Hello,

    has any new knowledge been collected on this?

    Thank you.



    ------------------------------
    fml2 2
    ------------------------------



  • 9.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Thu December 12, 2024 08:56 PM

    I have recently covered this using native UM API in Java and .NET on my blog. I will make some time to cover the JMS side as well. Stay tuned!

    https://akshith-webmethods.blogspot.com/



    ------------------------------
    Akshith Arremreddy
    ------------------------------



  • 10.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Fri December 13, 2024 01:32 AM

    That's an interesting blog indeed. I also use the native API as of now, but I am interested in sending the messages via JMS. Note that receiving messages via JMS works without problems for me.



    ------------------------------
    fml2 2
    ------------------------------



  • 11.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Thu December 19, 2024 08:41 AM

    You can use below steps to send the nProtobufevent to UM using JMS but on the recieving end it seems when we decode the bytes to string there are some BOM characters being returned on top of the actual message. I am suspecting this might be an encoding issue and you have to figure out the right encoding type to do get the right string. I will try to cover this in detail in my next blog post.

    Message message=null;
    nProtobufEvent evt=new nProtobufEvent(dynamicMessage.toByteArray(), UMMessageBuilder.getDescriptorForType().getName());
    message = session.createBytesMessage();
    ((BytesMessage) message).writeBytes(evt.getEventData());
    producer.send(message);



    ------------------------------
    Akshith Arremreddy
    ------------------------------



  • 12.  RE: How to send a nProtobufEvent via the JMS API?

    Posted Fri December 20, 2024 02:21 PM

    Thank you Akshit! I'll try this out.



    ------------------------------
    fml2 2
    ------------------------------