Class ActiveMQResourceAdapter

java.lang.Object
org.apache.activemq.ra.ActiveMQConnectionSupport
org.apache.activemq.ra.ActiveMQResourceAdapter
All Implemented Interfaces:
jakarta.resource.spi.ResourceAdapter, Serializable, MessageResourceAdapter

public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implements Serializable, MessageResourceAdapter
Knows how to connect to one ActiveMQ server. It can then activate endpoints and deliver messages to those end points using the connection configure in the resource adapter.

Must override equals and hashCode (JCA spec 16.4)

See Also:
  • Constructor Details

    • ActiveMQResourceAdapter

      public ActiveMQResourceAdapter()
  • Method Details

    • start

      public void start(jakarta.resource.spi.BootstrapContext bootstrapContext) throws jakarta.resource.spi.ResourceAdapterInternalException
      Specified by:
      start in interface jakarta.resource.spi.ResourceAdapter
      Throws:
      jakarta.resource.spi.ResourceAdapterInternalException
      See Also:
      • javax.resource.spi.ResourceAdapter#start(javax.resource.spi.BootstrapContext)
    • makeConnection

      public org.apache.activemq.ActiveMQConnection makeConnection() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • makeConnection

      public org.apache.activemq.ActiveMQConnection makeConnection(MessageActivationSpec activationSpec) throws jakarta.jms.JMSException
      Specified by:
      makeConnection in interface MessageResourceAdapter
      Parameters:
      activationSpec -
      Throws:
      jakarta.jms.JMSException
    • stop

      public void stop()
      Specified by:
      stop in interface jakarta.resource.spi.ResourceAdapter
      See Also:
      • javax.resource.spi.ResourceAdapter#stop()
    • getBootstrapContext

      public jakarta.resource.spi.BootstrapContext getBootstrapContext()
      Specified by:
      getBootstrapContext in interface MessageResourceAdapter
      Returns:
      bootstrap context
      See Also:
    • endpointActivation

      public void endpointActivation(jakarta.resource.spi.endpoint.MessageEndpointFactory endpointFactory, jakarta.resource.spi.ActivationSpec activationSpec) throws jakarta.resource.ResourceException
      Specified by:
      endpointActivation in interface jakarta.resource.spi.ResourceAdapter
      Throws:
      jakarta.resource.ResourceException
      See Also:
      • javax.resource.spi.ResourceAdapter#endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)
    • endpointDeactivation

      public void endpointDeactivation(jakarta.resource.spi.endpoint.MessageEndpointFactory endpointFactory, jakarta.resource.spi.ActivationSpec activationSpec)
      Specified by:
      endpointDeactivation in interface jakarta.resource.spi.ResourceAdapter
      See Also:
      • javax.resource.spi.ResourceAdapter#endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)
    • getXAResources

      public XAResource[] getXAResources(jakarta.resource.spi.ActivationSpec[] activationSpecs) throws jakarta.resource.ResourceException
      We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return the same XAResource.
      Specified by:
      getXAResources in interface jakarta.resource.spi.ResourceAdapter
      Throws:
      jakarta.resource.ResourceException
      See Also:
      • javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[])
    • getBrokerXmlConfig

      public String getBrokerXmlConfig()
      Specified by:
      getBrokerXmlConfig in interface MessageResourceAdapter
      See Also:
    • setBrokerXmlConfig

      public void setBrokerXmlConfig(String brokerXmlConfig)
      Sets the XML configuration file used to configure the ActiveMQ broker via Spring if using embedded mode.
      Parameters:
      brokerXmlConfig - is the filename which is assumed to be on the classpath unless a URL is specified. So a value of foo/bar.xml would be assumed to be on the classpath whereas file:dir/file.xml would use the file system. Any valid URL string is supported.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • getConnectionFactory

      public org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()
    • setConnectionFactory

      public void setConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory aConnectionFactory)