Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Program framework using the interfaces AsyncOltpMessageListener and OltpMessageListener

An OLTP message-driven bean receives the inbound message as the inMsg parameter of the onMessage() method. The received object is an OltpMessage object. From the OltpMessage object you can retrieve an OltpMessageContext object which in turn contains attributes of the received message and serves dialog OLTPmessage-driven beans as a factory for creating a response message:

  1. Access to the message context:
    OltpMessageContext oltpMsgCtx = inMsg.getMessageContext();
  2. Access the message content:
    The OltpMessage object allows access to the message content which may be processed in the form of OltpMessageRecord or OltpMessagePart objects.

    In the case of OltpMessagePart objects you specify:

    String inMsgTxt = "";
    if (inMsg.countMessageParts() > 0) {
    	OltpMessagePart inMsgPart;
    	Iterator it<OltpMessagePart> = inMsg.getMessageParts();
    	for ( ; it.hasNext(); ) {
    		inMsgPart = it.next();
    		inMsgTxt += inMsgPart.getText();
    	}
    }
    

    In the case of OltpMessageRecord objects you specify

    if (inMsg.countMessageRecords() > 0) {
    	OltpMessageRecord inMsgRec;
    	Iterator it<OltpMessageRecord> = inMsg.getMessageRecords();
    	for ( ; it.hasNext(); ) {
    		inMsgRec = it.next();
    		inMsgTxt += inMsgRec.getText();
    	}
    }
    
  3. Creating a reply message (only in the case of OLTP message-driven beans for dialog communication):

    An OLTP message-driven bean for dialog communication uses the OltpMessageContext interface to create an OltpMessage object for the reply message:

    OltpMessage outMsg = oltpMsgCtx.createMessage();

  4. The OltpMessage object needs to be populated with message content (only in the case of OLTP message-driven beans for dialog communication). You can do this in different ways using OltpMessageRecord and/or OltpMessagePart objects.

    • You should construct the response message using OltpMessagePart objects if the message recipient is to be sent a response structured in message segments. If the recipient is an UTM application then it reads each message segment transferred with an OltpMessagePart object by means of a separate MGET call.

    • If it is not important for the response message to be structured in message segments then it is more advantageous to use OltpMessageRecord objects.

You will find a code sample of an "OLTP message-driven beans for dialog communication" in OLTP message-driven beans and a code sample of an "OLTP message-driven beans for asynchronous communication " in OLTP message-driven beans .