Class JMSRemoteCommitProvider

java.lang.Object
org.apache.openjpa.event.AbstractRemoteCommitProvider
org.apache.openjpa.event.JMSRemoteCommitProvider
All Implemented Interfaces:
jakarta.jms.ExceptionListener, RemoteCommitProvider, Configurable, GenericConfigurable, Closeable

public class JMSRemoteCommitProvider extends AbstractRemoteCommitProvider implements Configurable, GenericConfigurable, jakarta.jms.ExceptionListener
JMS-based implementation of RemoteCommitProvider that listens for object modifications and propagates those changes to other RemoteCommitProviders over a JMS topic.
Since:
0.2.5.0
Author:
Patrick Linskey
  • Constructor Details

    • JMSRemoteCommitProvider

      public JMSRemoteCommitProvider()
  • Method Details

    • setTopic

      public void setTopic(String name)
      Sets the JMS Topic name. Defaults to topic/OpenJPACommitProviderTopic.
    • setTopicConnectionFactory

      public void setTopicConnectionFactory(String name)
      Sets the JMS TopicConnectionFactory name. Defaults to java:/ConnectionFactory.
    • setExceptionReconnectAttempts

      public void setExceptionReconnectAttempts(int attempts)
      The number of times to attempt to reconnect after a JMS send exception is detected. Defaults to 0, meaning no attempt to reconnect is made; the exception is logged and ignored.
    • setInto

      public void setInto(Options opts)
      Set a map of properties to pass to the InitialContext constructor for JNDI lookups. Implementation of GenericConfigurable.
      Specified by:
      setInto in interface GenericConfigurable
    • newContext

      protected Context newContext() throws NamingException
      Returns a new Context object for use by this provider.
      Throws:
      NamingException
    • broadcast

      public void broadcast(RemoteCommitEvent event)
      Description copied from interface: RemoteCommitProvider
      Notifies other remote event managers in this JVM and on other machines of changes to the cache. This method must not notify the event manager associated with the broker that originated this commit.
      Specified by:
      broadcast in interface RemoteCommitProvider
    • close

      public void close()
      Description copied from interface: RemoteCommitProvider
      Free the resources used by this provider.
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface RemoteCommitProvider
    • endConfiguration

      public void endConfiguration()
      Subclasses that need to perform actions in Configurable.endConfiguration() must invoke this method.
      Specified by:
      endConfiguration in interface Configurable
      Overrides:
      endConfiguration in class AbstractRemoteCommitProvider
    • connect

      protected void connect()
    • getMessageListener

      protected jakarta.jms.MessageListener getMessageListener()
    • createMessage

      protected jakarta.jms.Message createMessage(RemoteCommitEvent event) throws jakarta.jms.JMSException
      Returns a new Message to send to the topic. This implementation creates an ObjectMessage.
      Throws:
      jakarta.jms.JMSException
    • onException

      public void onException(jakarta.jms.JMSException ex)
      Specified by:
      onException in interface jakarta.jms.ExceptionListener