@Category(value="Basic") public class JavaListener<M> extends Object implements IPushingListener<M>, nl.nn.adapterframework.dispatcher.RequestProcessor, HasPhysicalDestination, ServiceClient
IbisJavaSender
(external call)
or IbisLocalSender
(internal call).
For more information see the ibis-servicedispatcher project.Modifier and Type | Field and Description |
---|---|
protected org.apache.logging.log4j.Logger |
log |
Constructor and Description |
---|
JavaListener() |
Modifier and Type | Method and Description |
---|---|
void |
afterMessageProcessed(PipeLineResult processResult,
RawMessageWrapper<M> rawMessage,
PipeLineSession pipeLineSession)
Called to perform actions (like committing or sending a reply) after a message has been processed by the
Pipeline.
|
void |
close()
Close all resources used for listening.
|
void |
configure()
configure() is called once at startup of the framework in the configure() method
of the owner of this listener. |
Message |
extractMessage(RawMessageWrapper<M> rawMessage,
Map<String,Object> context)
Extracts data from message obtained from
IPullingListener.getRawMessage(Map) or
IPushingListener.wrapRawMessage(Object, PipeLineSession) . |
static JavaListener<?> |
getListener(String name)
Returns JavaListener registered under the given name
|
static Set<String> |
getListenerNames() |
String |
getPhysicalDestinationName() |
void |
open()
Prepares the listener for receiving messages.
|
Message |
processRequest(Message message,
PipeLineSession session)
Method to implement for processing a request.
|
String |
processRequest(String correlationId,
String rawMessage,
HashMap context) |
void |
setExceptionListener(IbisExceptionListener listener)
Set a (single) listener that will be notified of any exceptions.
|
void |
setHttpWsdl(boolean httpWsdl)
If
true , the WSDL of the service provided by this listener will available for download |
void |
setIsolated(boolean b)
Deprecated.
|
void |
setLocal(String name)
Deprecated.
|
void |
setName(String name)
Internal name of the listener, as known to the adapter.
|
void |
setReturnedSessionKeys(String string)
Comma separated list of keys of session variables that should be returned to caller, for correct results as well as for erroneous results.
|
void |
setServiceName(String jndiName)
External Name of the listener.
|
void |
setSynchronous(boolean b)
Deprecated.
|
void |
setThrowException(boolean throwException)
Should the JavaListener throw a ListenerException when it occurs or return an error message
|
RawMessageWrapper<M> |
wrapRawMessage(M rawMessage,
PipeLineSession session)
Wrap a raw message in a MessageWrapper.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setHandler
getName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getDomain
public void configure() throws ConfigurationException
IListener
configure()
is called once at startup of the framework in the configure()
method
of the owner of this listener.
Purpose of this method is to reduce creating connections to databases etc. in the IPullingListener.getRawMessage(Map)
method.
As much as possible class-instantiating should take place in the
configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface IListener<M>
ConfigurationException
public void open() throws ListenerException
IListener
open()
is called once each time the listener is started.open
in interface IListener<M>
ListenerException
public void close() throws ListenerException
IListener
close
in interface IListener<M>
ListenerException
public RawMessageWrapper<M> wrapRawMessage(M rawMessage, PipeLineSession session)
IPushingListener
PipeLineSession
with properties
from the message.wrapRawMessage
in interface IPushingListener<M>
rawMessage
- The raw message data, unwrappedsession
- PipeLineSession
to populate with properties from the message.public String processRequest(String correlationId, String rawMessage, HashMap context) throws ListenerException
processRequest
in interface nl.nn.adapterframework.dispatcher.RequestProcessor
ListenerException
public Message processRequest(Message message, @Nonnull PipeLineSession session) throws ListenerException
ServiceClient
IListener
implementation.
processRequest
in interface ServiceClient
message
- Message
to processsession
- PipeLineSession
of the request. If the request has a correlation ID, it should be put into this session.Message
.ListenerException
- Thrown if an exception occurs.public static JavaListener<?> getListener(String name)
public void setExceptionListener(IbisExceptionListener listener)
IPushingListener
setExceptionListener
in interface IPushingListener<M>
public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<M> rawMessage, PipeLineSession pipeLineSession) throws ListenerException
IListener
afterMessageProcessed
in interface IListener<M>
ListenerException
public Message extractMessage(@Nonnull RawMessageWrapper<M> rawMessage, @Nonnull Map<String,Object> context) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
or
IPushingListener.wrapRawMessage(Object, PipeLineSession)
. May also extract
other parameters from the message and put those into the context.extractMessage
in interface IListener<M>
rawMessage
- The RawMessageWrapper
from which to extract the Message
.context
- Context to populate. Either a PipeLineSession
or a Map
threadContext depending on caller.Message
for adapter.ListenerException
public String getPhysicalDestinationName()
getPhysicalDestinationName
in interface HasPhysicalDestination
@Mandatory public void setName(String name)
javaListener
-attribute.setName
in interface INamedObject
public void setServiceName(String jndiName)
serviceName
-attribute.@Deprecated public void setLocal(String name)
@Deprecated public void setIsolated(boolean b)
@Deprecated public void setSynchronous(boolean b)
public void setReturnedSessionKeys(String string)
public void setThrowException(boolean throwException)
public void setHttpWsdl(boolean httpWsdl)
true
, the WSDL of the service provided by this listener will available for downloadCopyright © 2023 Frank!Framework. All rights reserved.