Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Service integration > Program mediations > Add mediation function to handler code > Work with the message header


Work with non-routing path fields in a message header

We can work with fields in a message header that identify and affect the behavior of messages. In addition to the routing fields (see Set routing addresses in a message header), there are a number of fields in the message header that you can work with. These fields affect important qualities and characteristics of the message, such as priority and reliability, identity, and so on. See Message header information for information about the equivalence of the header fields to JMS message header fields, and the methods available to work with them.


Procedure

  1. Locate the point in your mediation handler where you insert the functional mediation code, in the method handle (MessageContext context). The interface is MessageContext, and you should cast this to SIMessageContext unless you are only interested in the methods provided by MessageContext.
  2. Get the SIMessage from the MessageContext object. For example, SIMessage message = ((SIMessageContext)context).getSIMessage();
  3. Build your mediation header function in a similar way to these examples, and using the reference information in Message header information to help:

    1. Set the reliability of the message. For instance, siMessage.setReliability(Reliability.ASSURED_PERSISTENT);. In this case, the quality of service is set to the highest level.

    2. Set the time to live for a message - that is, the time, in milliseconds, that the message is allowed to remain on a queue before it is removed if it is not processed. For example, siMessage.setRemainingTimeToLive(1000000); will set the remaining time before the message should expire to 1000 seconds.

+

Search Tips   |   Advanced Search