|
Summary: Messages types, headers, and properties; creating a message.
Message TypesThe JMS standard indicates five different message types that an application can publish:
Message HeadersAll JMS Messages contain an enduring set of header fields. The header fields hold values employing both clients and providers to identify and route messages. Some header fields are automatically configured by the JMS provider; others may be configured by the JMS client. Message PropertiesEvery JMS Message also contains a set of property values. These hold additional information concerning the message. Properties are usually defined by the client application, and are configured by it prior to the message's delivery. JMS standards define many properties that JMS providers may, or may not, configure. JMS providers can also define their own properties. Creating a MessageA Message object is created from a variation of methods of the Session object. For more details, see Javadoc and the five different message types. // Create an Object message in one step ObjectMessage om = session.createObjectMessage(anObject); // Create an Object message in two steps ObjectMessage om = session.createObjectMessage(); om.setObject(anObject); // Create a Bytes message BytesMessage bm = session.createBytesMessage(); // then use various methods on BytesMessage to write bytes to // the message // Create a Text message in one step TextMessage = session.createTextMessage(aString); // Create a Text message in two steps TextMessage tm = session.createTextMessage(); tm.setText(aString); // Create a Stream message StreamMessage sm = session.createStreamMessage(); // then use various methods on StreamMessage to write bytes to // the message // Create a Map message MapMessage mm = session.createMapMessage // then use various methods on MapMessage to write name-value // pairs to the message |
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment