Package org.frankframework.http
Class PushingListenerAdapter
java.lang.Object
org.frankframework.http.PushingListenerAdapter
- All Implemented Interfaces:
IConfigurable
,IConfigurationAware
,IListener<Message>
,INamedObject
,IPushingListener<Message>
,IScopeProvider
,ServiceClient
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
ApiListener
,HttpListener
,RestListener
,WebServiceListener
public class PushingListenerAdapter
extends Object
implements IPushingListener<Message>, ServiceClient
Baseclass of a
IPushingListener
that enables a Receiver
to receive messages from Servlets.- Since:
- 4.12
- Author:
- Gerrit van Brakel
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterMessageProcessed
(PipeLineResult processResult, RawMessageWrapper<Message> rawMessage, PipeLineSession pipeLineSession) Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.void
initialize listener and registerthis
to the JNDIextractMessage
(RawMessageWrapper<Message> rawMessage, Map<String, Object> context) Extracts data from message obtained fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
.org.springframework.context.ApplicationContext
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.getName()
boolean
boolean
processRequest
(Message rawMessage, PipeLineSession session) Method to implement for processing a request.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setApplicationFaultsAsExceptions
(boolean b) void
setExceptionListener
(IbisExceptionListener exceptionListener) Set a (single) listener that will be notified of any exceptions.void
setHandler
(IMessageHandler<Message> handler) Set the handler that will do the processing of the message.void
Name of the listener as known to the adaptervoid
setRunning
(boolean running) void
start()
Prepares the listener for receiving messages.void
stop()
Close all resources used for listening.toString()
wrapRawMessage
(Message rawMessage, PipeLineSession session) Wrap a raw message in a MessageWrapper.
-
Field Details
-
log
protected org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
PushingListenerAdapter
public PushingListenerAdapter()
-
-
Method Details
-
configure
initialize listener and registerthis
to the JNDI- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIListener<Message>
- Throws:
ConfigurationException
-
start
public void start()Description copied from interface:IListener
Prepares the listener for receiving messages.open()
is called once each time the listener is started. -
stop
public void stop()Description copied from interface:IListener
Close all resources used for listening. Called once each time the listener is stopped. -
wrapRawMessage
Description copied from interface:IPushingListener
Wrap a raw message in a MessageWrapper. PopulatePipeLineSession
with properties from the message.- Specified by:
wrapRawMessage
in interfaceIPushingListener<Message>
- Parameters:
rawMessage
- The raw message data, unwrappedsession
-PipeLineSession
to populate with properties from the message.- Returns:
- Wrapped raw message
-
extractMessage
public Message extractMessage(@Nonnull RawMessageWrapper<Message> rawMessage, @Nonnull Map<String, Object> context) Description copied from interface:IListener
Extracts data from message obtained fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
. May also extract other parameters from the message and put those into the context.- Specified by:
extractMessage
in interfaceIListener<Message>
- Parameters:
rawMessage
- TheRawMessageWrapper
from which to extract theMessage
.context
- Context to populate. Either aPipeLineSession
or aMap
threadContext depending on caller.- Returns:
- input
Message
for adapter.
-
afterMessageProcessed
public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<Message> rawMessage, PipeLineSession pipeLineSession) Description copied from interface:IListener
Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.- Specified by:
afterMessageProcessed
in interfaceIListener<Message>
-
processRequest
Description copied from interface:ServiceClient
Method to implement for processing a request. This will usually delegate to aIListener
implementation.
TODO: We may want to add the correlationId parameter back to this method, for cleaner calling and cleaner implementation.- Specified by:
processRequest
in interfaceServiceClient
- Parameters:
rawMessage
-Message
to processsession
-PipeLineSession
of the request. If the request has a correlation ID, it should be put into this session.- Returns:
- Resulting
Message
. - Throws:
ListenerException
- Thrown if an exception occurs.
-
toString
-
setName
Name of the listener as known to the adapter- Specified by:
setName
in interfaceINamedObject
-
setHandler
Description copied from interface:IPushingListener
Set the handler that will do the processing of the message. Each of the received messages must be pushed through handler.processMessage()- Specified by:
setHandler
in interfaceIPushingListener<Message>
-
setExceptionListener
Description copied from interface:IPushingListener
Set a (single) listener that will be notified of any exceptions. The listener should use this listener to notify the receiver of any exception that occurs outside the processing of a message.- Specified by:
setExceptionListener
in interfaceIPushingListener<Message>
-
setApplicationFaultsAsExceptions
public void setApplicationFaultsAsExceptions(boolean b) -
setRunning
-
getName
- Specified by:
getName
in interfaceIConfigurationAware
- Specified by:
getName
in interfaceINamedObject
-
isApplicationFaultsAsExceptions
public boolean isApplicationFaultsAsExceptions() -
isRunning
public boolean isRunning() -
getConfigurationClassLoader
Description copied from interface:IScopeProvider
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.- Specified by:
getConfigurationClassLoader
in interfaceIScopeProvider
- Returns:
- returns the ClassLoader created by the
ClassLoaderManager
.
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()- Specified by:
getApplicationContext
in interfaceIConfigurationAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-