Create Messages
As described in Jakarta Messaging Message Bodies , EMS works with the following types of messages:
- Messages with no body
- Text Messages
- Map Messages
- Bytes Messages
- Stream Messages
- Object Messages
There is a separate create method for each type of message.
The following examples show how to create a simple text message containing the string "Hello."
- Java
Use the
Sessionobject’screateTextMessage()method to create aTextMessage:TextMessage message = session.createTextMessage("Hello");See the
tibjmsMsgProducer.javasample client for a working example. - C
Use the
tibemsTextMsg_Createfunction to create a text message of typetibemsTextMsg:tibemsTextMsg message = "Hello";status = tibemsTextMsg_Create(&message);See the
tibemsMsgProducer.csample client for a working example. - C#
Use the
Session.CreateTextMessagemethod to create text message of typeTextMessage:TextMessage message = session.CreateTextMessage("Hello");See the
csMsgProducer.cssample client for a working example.