public abstract class AbstractCodec extends java.lang.Object implements ConnectivityPlugin, HostSide, TransportSide
Message
objects as they are sent towards
the transport or host side.
Codecs can be implemented by inheriting from this class which
provides implementation of some of the methods. For simple codecs,
inheriting from AbstractSimpleCodec
may be more convenient
as it deals with batching of messages and ignoring null payload
messages.
Codecs should typically process a batch of Message
objects and pass the
batch on to the next plug-in in the chain. Unless they are looking
for certain control messages, codecs should ignore messages with null
payload,
passing them on to the next plug-in in the chain untouched.
MapHelper can be used to extract the content of payload.
Codecs must have a constructor with this signature:
(java.lang.Map<String, Object> instanceConfiguration, String chainId, org.apache.log4j.Logger logger) throws Exception, IllegalArgumentException
Modifier and Type | Field and Description |
---|---|
java.lang.String |
chainId
Chain name.
|
java.util.Map<java.lang.String,java.lang.Object> |
config
Configuration of this plug-in.
|
HostSide |
hostSide
The next plug-in in the chain towards host, as set by setNextTowardsHost.
|
TransportSide |
transportSide
The next plug-in in the chain towards transport, as set by setNextTowardsTransport.
|
Constructor and Description |
---|
AbstractCodec(java.util.Map<java.lang.String,java.lang.Object> config,
java.lang.String chainId,
org.apache.log4j.Logger logger)
Constructor, storing config, chainId and logger.
|
Modifier and Type | Method and Description |
---|---|
void |
hostReady()
No-op implementation of hostReady.
|
void |
setNextTowardsHost(HostSide hostSide)
Remember the host side of this codec.
|
void |
setNextTowardsTransport(TransportSide transportSide)
Remember the transport side of this codec.
|
void |
shutdown()
No-op implementation of shutdown.
|
void |
start()
No-op implementation of start.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sendBatchTowardsHost
sendBatchTowardsTransport
public final java.util.Map<java.lang.String,java.lang.Object> config
public final java.lang.String chainId
public HostSide hostSide
public TransportSide transportSide
public AbstractCodec(java.util.Map<java.lang.String,java.lang.Object> config, java.lang.String chainId, org.apache.log4j.Logger logger)
public final void setNextTowardsHost(HostSide hostSide)
public final void setNextTowardsTransport(TransportSide transportSide)
public void shutdown() throws java.lang.Exception
shutdown
in interface ConnectivityPlugin
java.lang.Exception
public void start() throws java.lang.Exception
shutdown
as well.start
in interface ConnectivityPlugin
java.lang.Exception
- only if a fatal error occurred during startup.public void hostReady() throws java.lang.Exception
hostReady
in interface ConnectivityPlugin
java.lang.Exception
Submit 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.