3.13.2.1.1. JMS

The JMS remote commit provider can be configured by setting the openjpa.RemoteCommitProvider property to contain the appropriate configuration properties. The JMS provider understands the following properties:

  • Topic: The topic that the remote commit provider should publish notifications to and subscribe to for notifications sent from other JVMs. Defaults to topic/OpenJPACommitProviderTopic

  • TopicConnectionFactory: The JNDI name of a jakarta.jms.TopicConnectionFactory factory to use for finding topics. Defaults to java:/ConnectionFactory. This setting may vary depending on the application server in use; consult the application server’s documentation for details of the default JNDI name for the jakarta.jms.TopicConnectionFactory instance. For example, under Weblogic, the JNDI name for the TopicConnectionFactory is jakarta.jms.TopicConnectionFactory.

  • ExceptionReconnectAttempts: The number of times to attempt to reconnect if the JMS system notifies OpenJPA of a serious connection error. Defaults to 0, meaning OpenJPA will log the error but otherwise ignore it, hoping the connection is still valid.

  • \*: All other configuration properties will be interpreted as settings to pass to the JNDI InitialContext on construction. For example, you might set the java.naming.provider.url property to the URL of the context provider.

To configure a factory to use the JMS provider, your properties might look like the following:

Example 163. JMS Remote Commit Provider Configuration
<property name="openjpa.RemoteCommitProvider"
    value="jms(ExceptionReconnectAttempts=5)"/>
Note

Because of the nature of JMS, it is important that you invoke EntityManagerFactory.close when finished with a factory. If you do not do so, a daemon thread will stay up in the JVM, preventing the JVM from exiting.

Note

The JMS provider sends events as jakarta.jms.ObjectMessages, which the JMS client deserializes on its own. The serialization class blacklist of OpenJPA, which the TCP provider applies to the events it receives, does not apply to this path. Restrict who may publish to the topic, and configure the deserialization filtering of your JMS provider (for example, the trusted packages of ActiveMQ) or a JVM-wide serialization filter.