@Category(value="Basic") public class Adapter extends Object implements IAdapter, org.springframework.beans.factory.NamedBean
Receivers
that receive the messages and a PipeLine
that transforms the incoming messages. Each adapter is part of a Configuration
.
Receiver
nested in the adapter. Each Receiver
is also responsible
for dealing with
the result of its received messages; the result is the output of the PipeLine
. The result
consists of the transformed message and a state. The Frank!Framework distinguishes between exit states
SUCCESS and ERROR. There is also a state REJECTED for messages that are not accepted by the Frank!Framework
and that are not processed by the PipeLine
. If the exit state is ERROR, the result message may
not be usable by the calling system. This can be fixed by adding an
errorMessageFormatter that formats the result message if the state is ERROR.
HasStatistics.Action
Modifier and Type | Field and Description |
---|---|
protected org.apache.logging.log4j.Logger |
msgLog |
static String |
PROCESS_STATE_ERROR |
static String |
PROCESS_STATE_OK |
Constructor and Description |
---|
Adapter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addErrorMessageToMessageKeeper(String msg,
Throwable t)
sends a warning to the log and to the messagekeeper of the adapter
|
boolean |
configurationSucceeded() |
void |
configure()
Instruct the adapter to configure itself.
|
void |
configureReceiver(Receiver<?> receiver) |
Message |
formatErrorMessage(String errorMessage,
Throwable t,
Message originalMessage,
String messageID,
INamedObject objectInError,
long receivedTime) |
String |
getBeanName() |
long |
getLastExitIsTimeoutDate(String pipeName) |
String |
getLastMessageDate()
retrieve the date and time of the last message.
|
String |
getLastMessageDate(String dateFormat) |
Date |
getLastMessageDateDate() |
MessageKeeper |
getMessageKeeper()
the MessageKeeper is for keeping the last
messageKeeperSize
messages available, for instance for displaying it in the webcontrol |
String |
getName() |
long |
getNumOfMessagesInError()
The number of messages for which processing ended unsuccessfully.
|
int |
getNumOfMessagesInProcess() |
long |
getNumOfMessagesProcessed()
Total of messages processed
|
long[] |
getNumOfMessagesStartProcessingByHour() |
PipeLine |
getPipeLine() |
Receiver<?> |
getReceiverByName(String receiverName) |
Receiver<?> |
getReceiverByNameAndListener(String receiverName,
Class<?> listenerClass) |
Iterable<Receiver<?>> |
getReceivers() |
RunState |
getRunState()
returns the runstate of the object.
|
String |
getRunStateAsString() |
StatisticsKeeper |
getStatsMessageProcessingDuration()
Return the total processing duration as a StatisticsKeeper
|
String |
getStatsUpSince()
return the date and time since active
Creation date: (19-02-2003 12:16:53)
|
String |
getStatsUpSince(String dateFormat) |
Date |
getStatsUpSinceDate() |
void |
iterateOverStatistics(StatisticsKeeperIterationHandler hski,
Object data,
HasStatistics.Action action) |
void |
logToMessageLogWithMessageContentsOrSize(org.apache.logging.log4j.Level level,
String logMessage,
String dataPrefix,
Message data) |
PipeLineResult |
processMessage(String messageId,
Message message,
PipeLineSession pipeLineSession) |
PipeLineResult |
processMessageWithExceptions(String messageId,
Message message,
PipeLineSession pipeLineSession) |
void |
registerReceiver(Receiver<?> receiver)
Receives incoming messages.
|
void |
setAutoStart(boolean autoStart)
AutoStart indicates that the adapter should be started when the configuration
is started.
|
void |
setConfiguration(Configuration configuration)
the configuration this adapter belongs to
|
void |
setDescription(String description)
some functional description of the
Adapter |
void |
setErrorMessageFormatter(IErrorMessageFormatter errorMessageFormatter)
Formatter for errors that can occur in this adapter.
|
void |
setLastExitState(String pipeName,
long lastExitStateDate,
String lastExitState) |
void |
setMessageKeeperSize(int size)
number of message displayed in ibisconsole
|
void |
setMsgLogHidden(boolean b)
If set to
true , the length of the message is shown in the msg log instead of the content of the message |
void |
setMsgLogLevel(nl.nn.adapterframework.core.Adapter.MessageLogLevel level)
Defines behaviour for logging messages.
|
void |
setName(String name)
name of the adapter
|
void |
setPipeLine(PipeLine pipeline)
The
PipeLine . |
void |
setReplaceNullMessage(boolean b)
If
true a null message is replaced by an empty message |
void |
setRequestReplyLogging(boolean requestReplyLogging)
Deprecated.
|
void |
setTargetDesignDocument(String string) |
void |
startRunning()
Start the adapter.
|
void |
stopRunning()
Stop the
Adapter and close all elements like receivers,
Pipeline, pipes etc. |
String |
toString() |
void |
waitForNoMessagesInProcess() |
protected void |
warn(String msg)
sends a warning to the log and to the messagekeeper of the adapter
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConfiguration, getDescription, isAutoStart
getApplicationContext
getConfigurationClassLoader
protected org.apache.logging.log4j.Logger msgLog
public static final String PROCESS_STATE_OK
public static final String PROCESS_STATE_ERROR
public void configure() throws ConfigurationException
IAdapter
configure
in interface IAdapter
configure
in interface IConfigurable
ConfigurationException
AbstractPipe.configure()
,
PipeLine.configure()
public void configureReceiver(Receiver<?> receiver) throws ConfigurationException
ConfigurationException
public boolean configurationSucceeded()
protected void warn(String msg)
protected void addErrorMessageToMessageKeeper(String msg, Throwable t)
public void setLastExitState(String pipeName, long lastExitStateDate, String lastExitState)
public long getLastExitIsTimeoutDate(String pipeName)
public Message formatErrorMessage(String errorMessage, Throwable t, Message originalMessage, String messageID, INamedObject objectInError, long receivedTime)
formatErrorMessage
in interface IAdapter
@JmxAttribute(description="The date/time of the last processed message") public String getLastMessageDate()
public Date getLastMessageDateDate()
public MessageKeeper getMessageKeeper()
messageKeeperSize
messages available, for instance for displaying it in the webcontrolgetMessageKeeper
in interface IAdapter
MessageKeeper
public void iterateOverStatistics(StatisticsKeeperIterationHandler hski, Object data, HasStatistics.Action action) throws SenderException
iterateOverStatistics
in interface HasStatistics
SenderException
@JmxAttribute(description="# Messages in Error") public long getNumOfMessagesInError()
@JmxAttribute(description="# Messages in process") public int getNumOfMessagesInProcess()
public long[] getNumOfMessagesStartProcessingByHour()
@JmxAttribute(description="# Messages Processed") public long getNumOfMessagesProcessed()
public Receiver<?> getReceiverByName(String receiverName)
getReceiverByName
in interface IAdapter
public Receiver<?> getReceiverByNameAndListener(String receiverName, Class<?> listenerClass)
public Iterable<Receiver<?>> getReceivers()
getReceivers
in interface IAdapter
public RunState getRunState()
IManagable
RunState
.getRunState
in interface IManagable
@JmxAttribute(description="RunState") public String getRunStateAsString()
public StatisticsKeeper getStatsMessageProcessingDuration()
StatisticsKeeper
@JmxAttribute(description="Up Since") public String getStatsUpSince()
public Date getStatsUpSinceDate()
public void logToMessageLogWithMessageContentsOrSize(org.apache.logging.log4j.Level level, String logMessage, String dataPrefix, Message data)
public PipeLineResult processMessage(String messageId, Message message, PipeLineSession pipeLineSession)
processMessage
in interface IAdapter
public PipeLineResult processMessageWithExceptions(String messageId, Message message, PipeLineSession pipeLineSession) throws ListenerException
processMessageWithExceptions
in interface IAdapter
ListenerException
public void registerReceiver(Receiver<?> receiver)
public void setErrorMessageFormatter(IErrorMessageFormatter errorMessageFormatter)
public void setPipeLine(PipeLine pipeline) throws ConfigurationException
PipeLine
.setPipeLine
in interface IAdapter
ConfigurationException
public PipeLine getPipeLine()
getPipeLine
in interface IAdapter
public void setConfiguration(Configuration configuration)
setConfiguration
in interface IAdapter
public void startRunning()
Runnable
interface. The actual starting is done
in the run
method.startRunning
in interface IManagable
Receiver.startRunning()
public void stopRunning()
Adapter
and close all elements like receivers,
Pipeline, pipes etc.
The adapter
will call the IReceiver
to stopListening
Also the PipeLine.close()
method will be called,
closing all registered pipes.
stopRunning
in interface IManagable
Receiver.stopRunning()
,
PipeLine.stop()
public void waitForNoMessagesInProcess() throws InterruptedException
InterruptedException
public String getBeanName()
getBeanName
in interface org.springframework.beans.factory.NamedBean
public void setName(String name)
setName
in interface INamedObject
@JmxAttribute(description="Name of the Adapter") public String getName()
getName
in interface IConfigurationAware
getName
in interface INamedObject
public void setDescription(String description)
Adapter
public void setAutoStart(boolean autoStart)
true
public void setReplaceNullMessage(boolean b)
true
a null message is replaced by an empty messagefalse
public void setMessageKeeperSize(int size)
public void setMsgLogLevel(nl.nn.adapterframework.core.Adapter.MessageLogLevel level) throws ConfigurationException
ConfigurationException
INFO, unless overridden by property msg.log.level.default
@Deprecated public void setRequestReplyLogging(boolean requestReplyLogging)
public void setMsgLogHidden(boolean b)
true
, the length of the message is shown in the msg log instead of the content of the messagefalse
public void setTargetDesignDocument(String string)
Copyright © 2023 Frank!Framework. All rights reserved.