org.apache.activemq.ra
Class ActiveMQResourceAdapter

java.lang.Object
  extended by org.apache.activemq.ra.ActiveMQResourceAdapter
All Implemented Interfaces:
Serializable, javax.resource.spi.ResourceAdapter

public class ActiveMQResourceAdapter
extends Object
implements javax.resource.spi.ResourceAdapter, Serializable

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)

Version:
$Revision$
See Also:
Serialized Form

Constructor Summary
ActiveMQResourceAdapter()
           
 
Method Summary
 void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec activationSpec)
           
 void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec activationSpec)
           
 boolean equals(Object o)
           
 javax.resource.spi.BootstrapContext getBootstrapContext()
           
 String getBrokerXmlConfig()
           
 String getClientid()
           
 ActiveMQConnectionFactory getConnectionFactory()
           
 Integer getDurableTopicPrefetch()
           
 ActiveMQConnectionRequestInfo getInfo()
           
 Long getInitialRedeliveryDelay()
           
 Integer getInputStreamPrefetch()
           
 Integer getMaximumRedeliveries()
           
 String getPassword()
           
 Integer getQueueBrowserPrefetch()
           
 Integer getQueuePrefetch()
           
 Short getRedeliveryBackOffMultiplier()
           
 Boolean getRedeliveryUseExponentialBackOff()
           
 String getServerUrl()
           
 Integer getTopicPrefetch()
           
 Boolean getUseInboundSession()
           
 String getUserName()
           
 XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
          We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return the same XAResource.
 int hashCode()
           
 boolean isUseInboundSessionEnabled()
           
 ActiveMQConnection makeConnection()
           
 ActiveMQConnection makeConnection(ActiveMQActivationSpec activationSpec)
           
 ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info)
           
 ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info, ActiveMQConnectionFactory connectionFactory)
           
 void setAllPrefetchValues(Integer i)
           
 void setBrokerXmlConfig(String brokerXmlConfig)
          Sets the XML configuration file used to configure the ActiveMQ broker via Spring if using embedded mode.
 void setClientid(String clientid)
           
 void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)
          This allows a connection factory to be configured and shared between a ResourceAdaptor and outbound messaging.
 void setDurableTopicPrefetch(Integer durableTopicPrefetch)
           
 void setInitialRedeliveryDelay(Long value)
           
 void setInputStreamPrefetch(Integer inputStreamPrefetch)
           
 void setMaximumRedeliveries(Integer value)
           
 void setPassword(String password)
           
 void setQueueBrowserPrefetch(Integer queueBrowserPrefetch)
           
 void setQueuePrefetch(Integer queuePrefetch)
           
 void setRedeliveryBackOffMultiplier(Short value)
           
 void setRedeliveryUseExponentialBackOff(Boolean value)
           
 void setServerUrl(String url)
           
 void setTopicPrefetch(Integer topicPrefetch)
           
 void setUseInboundSession(Boolean useInboundSession)
           
 void setUserName(String userid)
           
 void start(javax.resource.spi.BootstrapContext bootstrapContext)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveMQResourceAdapter

public ActiveMQResourceAdapter()
Method Detail

start

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

makeConnection

public ActiveMQConnection makeConnection()
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info)
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info,
                                         ActiveMQConnectionFactory connectionFactory)
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQActivationSpec activationSpec)
                                  throws javax.jms.JMSException
Parameters:
activationSpec -
Throws:
javax.jms.JMSException

stop

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

getBootstrapContext

public javax.resource.spi.BootstrapContext getBootstrapContext()
Returns:

endpointActivation

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

endpointDeactivation

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

getXAResources

public XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
                            throws javax.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 javax.resource.spi.ResourceAdapter
Throws:
javax.resource.ResourceException
See Also:
ResourceAdapter.getXAResources(javax.resource.spi.ActivationSpec[])

getClientid

public String getClientid()
Returns:

getPassword

public String getPassword()
Returns:

getServerUrl

public String getServerUrl()
Returns:

getUserName

public String getUserName()
Returns:

setClientid

public void setClientid(String clientid)
Parameters:
clientid -

setPassword

public void setPassword(String password)
Parameters:
password -

setServerUrl

public void setServerUrl(String url)
Parameters:
url -

setUserName

public void setUserName(String userid)
Parameters:
userid -

getBrokerXmlConfig

public String getBrokerXmlConfig()

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.
See Also:
#setUseEmbeddedBroker(Boolean)

getDurableTopicPrefetch

public Integer getDurableTopicPrefetch()

getInitialRedeliveryDelay

public Long getInitialRedeliveryDelay()

getInputStreamPrefetch

public Integer getInputStreamPrefetch()

getMaximumRedeliveries

public Integer getMaximumRedeliveries()

getQueueBrowserPrefetch

public Integer getQueueBrowserPrefetch()

getQueuePrefetch

public Integer getQueuePrefetch()

getRedeliveryBackOffMultiplier

public Short getRedeliveryBackOffMultiplier()

getRedeliveryUseExponentialBackOff

public Boolean getRedeliveryUseExponentialBackOff()

getTopicPrefetch

public Integer getTopicPrefetch()

isUseInboundSessionEnabled

public boolean isUseInboundSessionEnabled()

setAllPrefetchValues

public void setAllPrefetchValues(Integer i)

setDurableTopicPrefetch

public void setDurableTopicPrefetch(Integer durableTopicPrefetch)

setInitialRedeliveryDelay

public void setInitialRedeliveryDelay(Long value)

setInputStreamPrefetch

public void setInputStreamPrefetch(Integer inputStreamPrefetch)

setMaximumRedeliveries

public void setMaximumRedeliveries(Integer value)

setQueueBrowserPrefetch

public void setQueueBrowserPrefetch(Integer queueBrowserPrefetch)

setQueuePrefetch

public void setQueuePrefetch(Integer queuePrefetch)

setRedeliveryBackOffMultiplier

public void setRedeliveryBackOffMultiplier(Short value)

setRedeliveryUseExponentialBackOff

public void setRedeliveryUseExponentialBackOff(Boolean value)

setTopicPrefetch

public void setTopicPrefetch(Integer topicPrefetch)

getInfo

public ActiveMQConnectionRequestInfo getInfo()
Returns:
Returns the info.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getUseInboundSession

public Boolean getUseInboundSession()

setUseInboundSession

public void setUseInboundSession(Boolean useInboundSession)

getConnectionFactory

public ActiveMQConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)
This allows a connection factory to be configured and shared between a ResourceAdaptor and outbound messaging. Note that setting the connectionFactory will overload many of the properties on this POJO such as the redelivery and prefetch policies; the properties on the connectionFactory will be used instead.



Copyright © 2011 Apache Software Foundation. All Rights Reserved.