Class AbstractSimpleCodec
- All Implemented Interfaces:
HostSide
,TransportSide
transformMessageTowardsHost(Message)
and
transformMessageTowardsTransport(Message)
methods.
Subclasses should provide a constructor with the same signature as
AbstractSimpleCodec(org.slf4j.Logger, PluginConstructorParameters.CodecConstructorParameters)
.
-
Field Summary
Fields inherited from class com.softwareag.connectivity.AbstractCodec
hostSide, transportSide
Fields inherited from class com.softwareag.connectivity.ConnectivityPlugin
chainId, config, CONNECTIVITY_API_VERSION, host, logger, pluginName
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSimpleCodec
(org.slf4j.Logger logger, PluginConstructorParameters.CodecConstructorParameters params) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionhandleException
(Exception ex, Message message, boolean towardsTransport) Handle an exception thrown from transforming messages.void
sendBatchTowardsHost
(List<Message> messages) Transform a batch of messages and pass them on to the next plug-in synchronously.void
sendBatchTowardsTransport
(List<Message> messages) Transform a batch of messages and pass them on to the next plug-in synchronously.abstract Message
transformMessageTowardsHost
(Message message) Transform an individual message with a non-null payload.abstract Message
transformMessageTowardsTransport
(Message message) Transform an individual message with a non-null payload.transformNullPayloadTowardsHost
(Message message) Transform an individual message that has a null payload.Transform an individual message that has a null payload.Methods inherited from class com.softwareag.connectivity.AbstractCodec
hostReady, setNextTowardsHost, setNextTowardsTransport, shutdown, start, toString
Methods inherited from class com.softwareag.connectivity.ConnectivityPlugin
getStatusReporter
-
Constructor Details
-
AbstractSimpleCodec
public AbstractSimpleCodec(org.slf4j.Logger logger, PluginConstructorParameters.CodecConstructorParameters params) throws IllegalArgumentException, Exception Constructor. A subclass should provide its own constructor with the same signature as this one. This base class makes the parameters passed into its constructor available as member fields or methods for use by the subclass.- Parameters:
logger
- a slf4j Logger object which can be used to log to the host log file.params
- an extensible interface providing access to the configuration for this plug-in and other capabilities.- Throws:
IllegalArgumentException
- should be thrown from a plug-in's constructor if the configuration is invalid.Exception
- can be thrown to indicate an internal error.- Since:
- 9.12.0.1
-
-
Method Details
-
sendBatchTowardsTransport
Transform a batch of messages and pass them on to the next plug-in synchronously. For each message passed in, callstransformMessageTowardsTransport(Message)
ortransformNullPayloadTowardsTransport(Message)
(if the payload was null). On an exception, callshandleException(Exception, Message, boolean)
. Any non-null results are then sent in a batch by calling the next plug-in in this thread. -
sendBatchTowardsHost
Transform a batch of messages and pass them on to the next plug-in synchronously. For each message passed in, callstransformMessageTowardsHost(Message)
ortransformNullPayloadTowardsHost(Message)
(if the payload was null).On an exception, callshandleException(Exception, Message, boolean)
. Any non-null results are then sent in a batch by calling the next plug-in in this thread. -
transformMessageTowardsHost
Transform an individual message with a non-null payload. Decode an individual message, optionally producing a result. If this method throws then the exception will be logged and the message dropped.- Parameters:
message
- - the message, guaranteed to be non-null and have a non-null payload.- Returns:
- the decoded message, or null if it is to be discarded.
- Throws:
Exception
- See Also:
-
transformMessageTowardsTransport
Transform an individual message with a non-null payload. Encode an individual message, optionally producing a result. If this method throws then the exception will be logged and the message dropped.- Parameters:
message
- - the message, guaranteed to be non-null and have a non-null payload.- Returns:
- the encoded message, or null if it is to be discarded.
- Throws:
Exception
- See Also:
-
transformNullPayloadTowardsHost
Transform an individual message that has a null payload.By convention, most plug-ins silently pass through messages with null payloads without transforming them. Thus, the default implementation of this method is to just return the value passed in. If this method throws then the exception will be logged and the message dropped.
- Throws:
Exception
-
transformNullPayloadTowardsTransport
Transform an individual message that has a null payload.By convention, most plug-ins silently pass through messages with null payloads without transforming them. Thus, the default implementation of this method is to just return the value passed in. If this method throws then the exception will be logged and the message dropped.
- Throws:
Exception
-
handleException
Handle an exception thrown from transforming messages.The default implementation is to log an error and return null (thus discarding this message, but not others in the same batch)
- Parameters:
e
- T
-