How to use JMS message to create the same message if TibrvMsg is nested?

How to use JMS message to create the same message if TibrvMsg is nested?

book

Article ID: KB0086750

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
JMS does not support a hierarchical message. To allow a series of nested messages, TIBCO has extended the
JMS specification to allow the insertion of a "MapMessage" into the field of another "MapMessage"
and the use of arrays and other primitive types for values.

If you have TIBCO Rendezvous  programs and you want to exchange messages with  TIBCO Enterprise Message
Service preserving all RV features, you should use these extensions.

You have to first set a boolean property in the message to that it accepts TIBCO extensions: nested Map or Stream
messages and primitives array. In Java, the code would look like this.

msg.setBooleanProperty("JMS_TIBCO_MSG_EXT",true);
msg.setObject("submessage",submessage);

There is a sample in java\tibrv directory called tibjmsToRvMsg that shows you how to do it.


Here is a sample on how to handle nested MAP Messages with the C API.
This code assumes that the incoming MAP Message has a field called "EVENTS" that is an nested
message, which contains nested messages (named EVENTS_1, EVENTS_2, etc):

    tibemsMapMsg    topnode;
    tibemsMsgEnum   enumeration;
    const char*     name;

    tibemsMapMsg_GetMapMsg(msg,"EVENTS",&topnode);

    status = tibemsMapMsg_GetMapNames(topnode,&enumeration);
    if (status != TIBEMS_OK)
        fail("Error trying to get map fields enumerator", status);

    printf("Nested messages:\n");
    while((status = tibemsMsgEnum_GetNextName(enumeration,&name)) == TIBEMS_OK)
    {
        tibemsMapMsg event;

        status = tibemsMapMsg_GetMapMsg(topnode,name,&event);
        if (status != TIBEMS_OK)
            fail("Error trying to get nested message by name", status);

        tibemsMsg_Print(event);
    }
    tibemsMsgEnum_Destroy(enumeration);

Issue/Introduction

How to use JMS message to create the same message if TibrvMsg is nested?