Package org.frankframework.receivers
Class FrankListener
java.lang.Object
org.frankframework.receivers.FrankListener
- All Implemented Interfaces:
HasPhysicalDestination
,IConfigurable
,IConfigurationAware
,IListener<Message>
,INamedObject
,IPushingListener<Message>
,IScopeProvider
,ServiceClient
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@Category(BASIC)
public class FrankListener
extends Object
implements IPushingListener<Message>, HasPhysicalDestination, ServiceClient
Listener to receive messages sent by the
See the
FrankSender
, for situations where
calling an Adapter
directly is not desired. This could be because message / error logging is required for messages
sent to the subadapter.
See the
FrankSender
documentation for more information.-
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
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener.extractMessage
(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.static FrankListener
getListener
(String name) getName()
boolean
isOpen()
processRequest
(Message message, PipeLineSession session) Method to implement for processing a request.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setExceptionListener
(IbisExceptionListener listener) 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 by which it can be found by theFrankSender
.void
start()
Prepares the listener for receiving messages.void
stop()
Close all resources used for listening.wrapRawMessage
(Message rawMessage, PipeLineSession session) Wrap a raw message in a MessageWrapper.
-
Constructor Details
-
FrankListener
public FrankListener()
-
-
Method Details
-
getListener
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
-
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>
-
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
-
configure
public void configure()Description copied from interface:IListener
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener. Purpose of this method is to reduce creating connections to databases etc. in theIPullingListener.getRawMessage(Map)
method. As much as possible class-instantiating should take place in theconfigure()
orIListener.start()
method, to improve performance.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIListener<Message>
-
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. -
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>
-
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.
-
setName
Name of the listener by which it can be found by theFrankSender
. If this is not configured, the name will default to the name of theAdapter
. The name of theFrankListener
must be unique across the configuration.- Specified by:
setName
in interfaceINamedObject
- Parameters:
name
- Name of the listener. If not set, will default toAdapter
name.
-
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:
message
-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.
-
getDomain
- Specified by:
getDomain
in interfaceHasPhysicalDestination
-
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
-
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
.
-
getName
- Specified by:
getName
in interfaceIConfigurationAware
- Specified by:
getName
in interfaceINamedObject
-
isOpen
public boolean isOpen() -
getHandler
-
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>
-