public abstract class AbstractSimpleCodec extends AbstractCodec
Codec
interface; handles batches of messages and translate to
individual method invocations.
Handles batches of messages and ignoring null payload messages (by
default). Implementors will typically sub-class this class,
providing an implementation of the
transformMessageTowardsHost(Message)
and
transformMessageTowardsTransport(Message)
methods.
chainId, config, hostSide, transportSide
Constructor and Description |
---|
AbstractSimpleCodec(java.util.Map<java.lang.String,java.lang.Object> config,
java.lang.String chainId,
org.apache.log4j.Logger logger)
Constructor, passing parameters to AbstractCodec.
|
Modifier and Type | Method and Description |
---|---|
Message |
handleException(java.lang.Exception ex,
Message message,
boolean towardsTransport)
Handle an exception thrown from transforming messages.
|
void |
sendBatchTowardsHost(java.util.List<Message> messages)
Transform a batch of messages and pass them on to the next
plug-in synchronously.
|
void |
sendBatchTowardsTransport(java.util.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.
|
Message |
transformNullPayloadTowardsHost(Message message)
Transform an individual message that has a null payload.
|
Message |
transformNullPayloadTowardsTransport(Message message)
Transform an individual message that has a null payload.
|
hostReady, setNextTowardsHost, setNextTowardsTransport, shutdown, start
public AbstractSimpleCodec(java.util.Map<java.lang.String,java.lang.Object> config, java.lang.String chainId, org.apache.log4j.Logger logger)
public void sendBatchTowardsTransport(java.util.List<Message> messages)
public void sendBatchTowardsHost(java.util.List<Message> messages)
public abstract Message transformMessageTowardsHost(Message message) throws java.lang.Exception
message
- - the message, guaranteed to be non-null and have a non-null payload.java.lang.Exception
transformNullPayloadTowardsHost(Message)
public abstract Message transformMessageTowardsTransport(Message message) throws java.lang.Exception
message
- - the message, guaranteed to be non-null and have a non-null payload.java.lang.Exception
transformNullPayloadTowardsTransport(Message)
public Message transformNullPayloadTowardsHost(Message message)
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.
public Message transformNullPayloadTowardsTransport(Message message)
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.
public Message handleException(java.lang.Exception ex, Message message, boolean towardsTransport)
The default implementation is to log an error and return null (thus discarding this message, but not others in the same batch)
e
- TSubmit a bug or feature
Copyright (c) 2013-2016 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.