Package org.apache.axis2.transport.jms
Class JMSListener
- java.lang.Object
-
- org.apache.axis2.transport.base.AbstractTransportListener
-
- org.apache.axis2.transport.base.AbstractTransportListenerEx<JMSEndpoint>
-
- org.apache.axis2.transport.jms.JMSListener
-
- All Implemented Interfaces:
TransportListener,TransportErrorSource,ManagementSupport
public class JMSListener extends AbstractTransportListenerEx<JMSEndpoint> implements ManagementSupport, TransportErrorSource
The revamped JMS Transport listener implementation. CreatesServiceTaskManagerinstances for each service requesting exposure over JMS, and stops these if they are undeployed / stopped.A service indicates a JMS Connection factory definition by name, which would be defined in the JMSListner on the axis2.xml, and this provides a way to reuse common configuration between services, as well as to optimize resources utilized
If the connection factory name was not specified, it will default to the one named "default" {@see JMSConstants.DEFAULT_CONFAC_NAME}
If a destination JNDI name is not specified, a service will expect to use a Queue with the same JNDI name as of the service. Additional Parameters allows one to bind to a Topic or specify many more detailed control options. See package documentation for more details
All Destinations / JMS Administered objects used MUST be pre-created or already available
-
-
Field Summary
Fields Modifier and Type Field Description static StringTRANSPORT_NAME-
Fields inherited from class org.apache.axis2.transport.base.AbstractTransportListener
cfgCtx, config, isNonBlocking, log, metrics, state, useAxis2ThreadPool, workerPool
-
Fields inherited from interface org.apache.axis2.kernel.TransportListener
HOST_ADDRESS, PARAM_PORT
-
-
Constructor Summary
Constructors Constructor Description JMSListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddErrorListener(TransportErrorListener listener)protected JMSEndpointcreateEndpoint()protected voiddoInit()Initialize the transport.JMSConnectionFactorygetConnectionFactory(AxisService service)Return the connection factory name for this service.voidmaintenenceShutdown(long millis)Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenencevoidpause()Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete.voidremoveErrorListener(TransportErrorListener listener)voidresume()Resume the lister - Brings the lister into active mode back from a paused stateprotected voidstartEndpoint(JMSEndpoint endpoint)Listen for JMS messages on behalf of the given serviceprotected voidstopEndpoint(JMSEndpoint endpoint)Stops listening for messages for the service thats undeployed or stopped-
Methods inherited from class org.apache.axis2.transport.base.AbstractTransportListenerEx
getEndpoints, getEPRsForService, init, start, startListeningForService, stop, stopListeningForService
-
Methods inherited from class org.apache.axis2.transport.base.AbstractTransportListener
createMessageContext, destroy, disableTransportForService, getActiveThreadCount, getAvgSizeReceived, getAvgSizeSent, getBytesReceived, getBytesSent, getConfigurationContext, getEPRForService, getEPRsForService, getFaultsReceiving, getFaultsSending, getLastResetTime, getMaxSizeReceived, getMaxSizeSent, getMessagesReceived, getMessagesSent, getMetricsCollector, getMetricsWindow, getMinSizeReceived, getMinSizeSent, getQueueSize, getResponseCodeTable, getSessionContext, getTimeoutsReceiving, getTimeoutsSending, getTransportInDescription, getTransportName, handleException, handleIncomingMessage, logException, resetStatistics
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.axis2.transport.base.ManagementSupport
getActiveThreadCount, getAvgSizeReceived, getAvgSizeSent, getBytesReceived, getBytesSent, getFaultsReceiving, getFaultsSending, getLastResetTime, getMaxSizeReceived, getMaxSizeSent, getMessagesReceived, getMessagesSent, getMetricsWindow, getMinSizeReceived, getMinSizeSent, getQueueSize, getResponseCodeTable, getTimeoutsReceiving, getTimeoutsSending, resetStatistics
-
-
-
-
Field Detail
-
TRANSPORT_NAME
public static final String TRANSPORT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
doInit
protected void doInit() throws AxisFaultDescription copied from class:AbstractTransportListenerExInitialize the transport. This method will be called after the initialization work inAbstractTransportListenerand before the first endpoint is created, i.e. before the first call toAbstractTransportListenerEx.createEndpoint().- Specified by:
doInitin classAbstractTransportListenerEx<JMSEndpoint>- Throws:
AxisFault
-
createEndpoint
protected JMSEndpoint createEndpoint()
- Specified by:
createEndpointin classAbstractTransportListenerEx<JMSEndpoint>
-
startEndpoint
protected void startEndpoint(JMSEndpoint endpoint) throws AxisFault
Listen for JMS messages on behalf of the given service- Specified by:
startEndpointin classAbstractTransportListenerEx<JMSEndpoint>- Parameters:
service- the Axis service for which to listen for messages- Throws:
AxisFault
-
stopEndpoint
protected void stopEndpoint(JMSEndpoint endpoint)
Stops listening for messages for the service thats undeployed or stopped- Specified by:
stopEndpointin classAbstractTransportListenerEx<JMSEndpoint>- Parameters:
service- the service that was undeployed or stopped
-
getConnectionFactory
public JMSConnectionFactory getConnectionFactory(AxisService service)
Return the connection factory name for this service. If this service refers to an invalid factory or defaults to a non-existent default factory, this returns null- Parameters:
service- the AxisService- Returns:
- the JMSConnectionFactory to be used, or null if reference is invalid
-
pause
public void pause() throws AxisFaultPause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete. This helps bring an instance into a maintenence mode- Specified by:
pausein interfaceManagementSupport- Overrides:
pausein classAbstractTransportListener- Throws:
AxisFault- on error
-
resume
public void resume() throws AxisFaultResume the lister - Brings the lister into active mode back from a paused state- Specified by:
resumein interfaceManagementSupport- Overrides:
resumein classAbstractTransportListener- Throws:
AxisFault- on error
-
maintenenceShutdown
public void maintenenceShutdown(long millis) throws AxisFaultStop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence- Specified by:
maintenenceShutdownin interfaceManagementSupport- Overrides:
maintenenceShutdownin classAbstractTransportListener- Parameters:
millis- a number of milliseconds to wait until pending requests are allowed to complete- Throws:
AxisFault- on error
-
addErrorListener
public void addErrorListener(TransportErrorListener listener)
- Specified by:
addErrorListenerin interfaceTransportErrorSource
-
removeErrorListener
public void removeErrorListener(TransportErrorListener listener)
- Specified by:
removeErrorListenerin interfaceTransportErrorSource
-
-