In addition to receiving callbacks when a particular PersistenceManager goes through certain life cycle events, it is possible to receive notification when remote transactions commit. To do this, you must configure the PersistenceManagerFactory to use a RemoteCommitProvider (see below). Given that a RemoteCommitProvider is properly configured, it is possible to register a RemoteCommitListener that will be alerted with a list of committed object IDs whenever a transaction on a remote machine successfully commits.
The JMS RemoteCommitProvider can be configured by setting the com.solarmetric.kodo.RemoteCommitProviderProperties to contain the appropriate configuration properties. The JMS provider understands the following properties:
Topic
Default: topic/KodoCommitProviderTopic
Description: The topic that the remote commit provider should publish notifications to and subscribe to for notifications sent from other JVMs.
TopicConnectionFactory
Default: java:/ConnectionFactory
Description: The JNDI name of a javax.naming.TopicConnectionFactory factory to use for finding topics.
To configure a PersistenceManagerFactory to use the JMS provider, your properties filename might look like the following:
Example 7.11. Configuring a PersistenceManagerFactory to use a JMS remote commit provider mechanism
com.solarmetric.kodo.RemoteCommitProviderClass= \ com.solarmetric.kodo.runtime.event.impl.JMSRemoteCommitProvider com.solarmetric.kodo.RemoteCommitProviderProperties= \ Topic=topic/KodoCommitProviderTopic
![]() | Note |
---|---|
Because of the nature of JMS, it is important that you invoke PersistenceManagerFactoryImpl.close() when finished with a PersistenceManagerFactory and all its PersistenceManager objects. If you do not do so, a daemon thread will stay up in the JVM, preventing the JVM from exiting. |
The TCP RemoteCommitProvider has several options that are defined as host specifications containing a host name or IP address and an optional port separated by a colon. For example, the host specification saturn.solarmetric.com:1234 represents an InetAddress retrieved by invoking InetAddress.getByName ("saturn.solarmetric.com") and a port of 1234.
The TCP provider can be configured by setting the com.solarmetric.kodo.RemoteCommitProviderProperties to contain the appropriate configuration properties. The TCP provider understands the following properties:
Port
Default: 5636
Description: The TCP port that the provider should listen on for commit notifications.
Addresses
Default: none
Description: A semicolon-separated list of IP addresses to which notifications should be sent. No default value.
To configure a PersistenceManagerFactory to use the TCP provider, your properties filename might look like the following:
Example 7.12. Configuring a PersistenceManagerFactory to use a TCP remote commit provider mechanism
com.solarmetric.kodo.RemoteCommitProviderClass= \ com.solarmetric.kodo.runtime.event.impl.TCPRemoteCommitProvider com.solarmetric.kodo.RemoteCommitProviderProperties= \ Addresses=10.0.1.10;10.0.1.11;10.0.1.12;10.0.1.13
Additional mechanisms for remote event notification can be easily developed by creating an implementation of the RemoteCommitProvider interface, possibly by extending the RemoteCommitProviderImpl abstract class. For details on particular customization needs, contact SolarMetric at jdosupport@solarmetric.com.