Package org.apache.ofbiz.service.jms
Class AbstractJmsListener
- java.lang.Object
-
- org.apache.ofbiz.service.jms.AbstractJmsListener
-
- All Implemented Interfaces:
javax.jms.ExceptionListener
,javax.jms.MessageListener
,GenericMessageListener
- Direct Known Subclasses:
JmsQueueListener
,JmsTopicListener
public abstract class AbstractJmsListener extends java.lang.Object implements GenericMessageListener, javax.jms.ExceptionListener
AbstractJmsListener
-
-
Field Summary
Fields Modifier and Type Field Description protected LocalDispatcher
dispatcher
protected boolean
isConnected
static java.lang.String
module
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJmsListener(Delegator delegator)
Initializes the LocalDispatcher for this service listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isConnected()
Indicator if a connection is present.void
onException(javax.jms.JMSException je)
On exception try to re-establish connection to the JMS server.void
onMessage(javax.jms.Message message)
Receives the MapMessage and processes the service.void
refresh()
Refresh the connection.protected java.util.Map<java.lang.String,java.lang.Object>
runService(javax.jms.MapMessage message)
Runs the service defined in the MapMessageprotected void
setConnected(boolean connected)
Setter method for the connected field.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ofbiz.service.jms.GenericMessageListener
close, load
-
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
dispatcher
protected LocalDispatcher dispatcher
-
isConnected
protected boolean isConnected
-
-
Constructor Detail
-
AbstractJmsListener
protected AbstractJmsListener(Delegator delegator)
Initializes the LocalDispatcher for this service listener.- Parameters:
delegator
- the delegator associated to the dispatcher
-
-
Method Detail
-
runService
protected java.util.Map<java.lang.String,java.lang.Object> runService(javax.jms.MapMessage message)
Runs the service defined in the MapMessage- Parameters:
message
-- Returns:
- Map
-
onMessage
public void onMessage(javax.jms.Message message)
Receives the MapMessage and processes the service.- Specified by:
onMessage
in interfacejavax.jms.MessageListener
- See Also:
MessageListener.onMessage(Message)
-
onException
public void onException(javax.jms.JMSException je)
On exception try to re-establish connection to the JMS server.- Specified by:
onException
in interfacejavax.jms.ExceptionListener
- See Also:
ExceptionListener.onException(JMSException)
-
refresh
public void refresh() throws GenericServiceException
Description copied from interface:GenericMessageListener
Refresh the connection.- Specified by:
refresh
in interfaceGenericMessageListener
- Throws:
GenericServiceException
- See Also:
GenericMessageListener.refresh()
-
isConnected
public boolean isConnected()
Description copied from interface:GenericMessageListener
Indicator if a connection is present.- Specified by:
isConnected
in interfaceGenericMessageListener
- Returns:
- true if connectio is present.
- See Also:
GenericMessageListener.isConnected()
-
setConnected
protected void setConnected(boolean connected)
Setter method for the connected field.- Parameters:
connected
-
-
-