EDB-JDBC JMS API supports the following message types and can be used in a standard way:
Message type
JMS type
aq$_jms_message
javax.jms.Message
aq$_jms_text_message
javax.jms.TextMessage
aq$_jms_bytes_message
javax.jms.BytesMessage
aq$_jms_object_message
javax.jms.ObjectMessage
Please note that the corresponding payload types (user-defined types) are not pre-defined and must be created by the user before configuring the queue table. This is discussed in the upcoming sections.
You can specify schema-qualified user-defined types, but the property types and message types must be in the same schema.
Message properties
All of the above-mentioned message types supports setting and getting message properties. Before creating the actual message type, you must create the corresponding user-defined type for message properties.
This example shows how to create the user-defined type for message properties:
All primitive types of message properties are supported.
TextMessage
Text messages can be sent using the TextMessage interface. EDBTextMessageImpl is an implementation of TextMessage, but for most cases, you will be using the standard TextMessage. Before using the text message, it is necessary to create a user-defined type for it.
This example shows how to create the user-defined messagetype for TextMessage:
Once the user-defined type is created, you can create the queue table using this type. This example shows how to create the queue table using the above created user-defined message type.
After setting up the queue table, you can send and receive TextMessages using the standard procedure outlined in the Java code snippet:
BytesMessage
The BytesMessage is used to send a stream of bytes. EDBBytesMessageImpl is an implementation of BytesMessage, but in most cases, you will use the standard BytesMessage. Before using the bytes message, a user-defined type must be created.
This example shows how to create the user-defined type for BytesMessage:
Now, BytesMessage can be sent and received in the standard way.
This example shows how to create and use a BytesMessage in Java:
ObjectMessage
An ObjectMessage is used to send a serializable object as a message. EDBObjectMessageImpl is an implementation of ObjectMessage, but the standard ObjectMessage is most commonly used.
Before using the ObjectMessage, it is necessary to create the user-defined type for the object message.
This example shows how to create the user-defined type for ObjectMessage:
For example we have the following serializable Java class:
This example shows how to use ObjectMessage to send a message containing an object of this class:
Message
A Message can be used to send a message with only properties and no body. EDBMessageImpl is an implementation of a Message, but you will most often use the standard Message. Before using a Message, it is required to create a user-defined type.
This example shows how to create the user-defined type for Message:
This example shows how to send a message that contains only properties and no body: