JMS consumer endpoints specify the type of messages they use. JMS consumer endpoint can use either a JMS ObjectMessage
or a JMS TextMessage
. When using an ObjectMessage
the consumer endpoint uses a byte[] as the method for storing data into and retrieving data from the JMS message body. When messages are sent, the message data, including any formating information, is packaged into a byte[] and placed into the message body before it is placed on the wire. When messages are received, the consumer endpoint will attempt to unmarshall the data stored in
the message body as if it were packed in a byte[].
When using a TextMessage
, the consumer endpoint uses a string as the method for storing and retrieving data from the message body. When messages are sent, the message information, including any format-specific information, is converted into a string and placed into the JMS message body. When messages are received the consumer endpoint will attempt to unmarshall the data stored in the JMS message body as if it were packed into a string.
When native JMS applications interact with Celtix Enterprise consumers, the JMS application is responsible for interpreting the message and the formatting information. For example, if the Celtix Enterprise contract specifies that the binding used for a JMS endpoint is SOAP, and the messages are packaged as TextMessage
, the receiving JMS application will get a text message containing all of the SOAP envelope information.
Consumer endpoint can be configured in one of two ways:
Tip | |
---|---|
The recommended method is to place the consumer endpoint specific information into the Celtix Enterprise configuration file for the endpoint. |
Consumer endpoint configuration is specified using the jms:conduit
element. Using this configuration element, you specify the message type supported by the consumer endpoint using the jms:runtimePolicy
child element. The message type is specified using the messageType
attribute. The messageType
attribute has two possible values:
Table 2.2. messageType
Values
text
|
Specifies that the data will be packaged as a TextMessage . |
binary
|
specifies that the data will be packaged as an ObjectMessage . |
Example 2.3, “Configuration for a JMS Consumer Endpoint” shows a configuration entry for configuring a JMS consumer endpoint.
Example 2.3. Configuration for a JMS Consumer Endpoint
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ct="http://cxf.apache.org/configuration/types" xmlns:jms="http://cxf.apache.org/transports/jms" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> ... <jms:conduit id="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"> <jms:address ... > ... </jms:address> ... <jms:runtimePolicy messageType="binary"/> ... </jms:conduit> ... </beans>