<document>
<localtoc/>

The `ConnectionFactory` resource defines the JMS factory for creating JMS connections.

<resource jndi-name="jms/factory" type="com.caucho.jms.ConnectionFactoryImpl"/>

If an application creates a named queue or topic using the the JMS Session, Resin's default behaviour is to create a memory queue or topic. The jdbc-manager configuration of the connection factory causes creation of a jdbc queue or topic instead.

<resource jndi-name="jms/factory" type="com.caucho.jms.ConnectionFactoryImpl"/> <init> <jdbc-manager> <data-source>jdbc/database</data-source> </jdbc-manager> </init> </resource>
client-id clientID value for durable subscriptions pseudo-random generated value
jdbc-manager Use jdbc queues and topics for queues and topics created using the JMS Session object, see jdbc-manager use a memory queue for created queues and topics

The JDBC Queue and Topic store the messages using a JDBC DataSource. The data source is defined in a <database> element. Resin's internal file-based database can be used for single-JVM messaging. A central database is used for clusters and situations where more than one is a producer or consumer.

<database jndi-name="jdbc/resin"> <driver type="com.caucho.db.jdbc.ConnectionPoolDataSourceImpl"> <path>WEB-INF/db</path> </driver> </database> <resource jndi-name="jms/my-queue" type="com.caucho.jms.jdbc.JdbcQueue"> <init> <queue-name>my-queue</queue-name> <jdbc-manager> <data-source>jdbc/resin</data-source> </jdbc-manager> </init> </resource>
queue-name Name of the queue required
jdbc-manager Configuration of database usage, see jdbc-manager required
<database> <jndi-name>jdbc/jms</jndi-name> <driver> <type>com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource</type> <url>jdbc:mysql://localhost:3306/jms</url> <user>username</user> <password>password</password> </driver> ... </database> <resource jndi-name="jms/my-topic" type="com.caucho.jms.jdbc.JdbcTopic"> <init> <topic-name>my-topic</topic-name> <jdbc-manager> <data-source>jdbc/jms</data-source> </jdbc-manager> </init> </resource>
topic-name Name of the topic required
jdbc-manager Configuration of database usage, see jdbc-manager required
consumer-table Name of the table to use for storing consumers resin_jms_consumer
data-source JDBC DataSource required
destination-table Name of the table to use for storing destinations resin_jms_destination
message-table Name of the table to use for storing messages resin_jms_message
purge-interval Frequency for purging of expired messages 60s
poll-interval Polling interval when there is a message listener no polling
tablespace Tablespace for Oracle blobs only none

The Memory Queue and Topic are non-persistent. If the server restarts or even if the Queue's environment restarts, the messaging data will be lost. Applications needing persistent messaging should use the JDBC Queues.

<resource jndi-name="jms/factory" type="com.caucho.jms.ConnectionFactoryImpl"/> <resource jndi-name="jms/my-queue" type="com.caucho.jms.memory.MemoryQueue"> <init> <queue-name>my-queue</queue-name> </init> </resource> <resource jndi-name="jms/factory" type="com.caucho.jms.ConnectionFactoryImpl"/> <resource jndi-name="jms/my-topic" type="com.caucho.jms.memory.MemoryTopic"> <init> <topic-name>my-topic</topic-name> </init> </resource>
</document>