| Flex 2 Developer's Guide > Data Access and Interconnectivity > Configuring the Message Service > Configuring Message Service destinations > Configuring the JMS adapter | |||
You use the JMS adapter to subscribe to JMS topics or queues configured on an implementation of the Java Message Service. This adapter lets Java JMS publishers and subscribers share the same destination as a Flex client application. Java code can publish messages to the Flex application, and Java code can respond to messages that the Flex application publishes.
You configure the JMS adapter individually for the destinations that use it. You must configure the adapter with the proper Java Naming and Directory Interface (JNDI) information and JMS ConnectionFactory information to look up the connection factory in JNDI, create a connection from it, create a session on behalf of the Flex client, and create a publisher and subscribers on behalf of the Flex client.
The following example shows a destination that uses the JMS adapter:
...
<destination id="chat-topic-jms">
<properties>
...
<jms>
<destination-type>Topic</destination-type>
<message-type>javax.jms.TextMessage</message-type>
<connection-factory>jms/flex/TopicConnectionFactory
</connection-factory>
<destination-jndi-name>jms/topic/flex/simpletopic
</destination-jndi-name>
<destination-name>FlexTopic
</destination-name>
<delivery-mode>NON_PERSISTENT</delivery-mode>
<message-priority>DEFAULT_PRIORITY</message-priority>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<transacted-sessions>false</transacted-sessions>
<!-- (Optional) JNDI environment. Use when using JMS on a remote JNDI server. Used to specify the JNDI environment to access an external JMS provider. -->
<initial-context-environment>
<property>
<name>Context.SECURITY_PRINCIPAL</name>
<value>anonymous</value>
</property>
<property>
<name>Context.SECURITY_CREDENTIALS</name>
<value>anonymous</value>
</property>
<property>
<name>Context.PROVIDER_URL</name>
<value>http://{server.name}:1856</value>
</property>
<property>
<name>Context.INITIAL_CONTEXT_FACTORY</name>
<value>fiorano.jms.runtime.naming.FioranoInitialContextFactory
</value>
</property>
</initial-context-environment>
</jms>
</properties>
...
<adapter ref="jms"/>
</destination>
...
The JMS adapter accepts the following configuration properties. For more specific information about JMS, see the Java Message Service specification or your application server documentation.
|
Property |
Description |
|---|---|
destination-type
|
(Optional) Type of messaging that the adapter is performing. Valid values are |
message-type
|
Type of the message to use when transforming Flex messages into JMS messages. Supported types are javax.jms.TextMessage and javax.jms.ObjectMessage. If the client-side Publisher component sends messages as objects, you must set the message-type to javax.jms.ObjectMessage. |
connection-factory
|
Name of the JMS connection factory in JNDI. |
destination-jndi-name
|
Name of the destination in the JNDI registry. |
destination-name
|
(Optional) Name of the destination in JMS. The default value is the Flex destination |
delivery-mode
|
JMS DeliveryMode for producers. The valid values are |
message-priority
|
JMS priority for messages that Flex producers send. The valid values are |
acknowledge-mode
|
JMS message acknowledgment mode. The valid values are |
transacted-sessions
|
JMS session transaction mode. |
initial-context-environment
|
A set of JNDI properties for configuring the InitialContext used for JNDI lookups of your ConnectionFactory and Destination. Lets you use a remote JNDI server for JMS. For more information, see Using a remote JMS provider. |
Flex 2.01