Class AbstractCodec
- All Implemented Interfaces:
HostSide
,TransportSide
- Direct Known Subclasses:
AbstractSimpleCodec
Implementors may extend this class, providing an
implementation of its abstract methods to provide any required
transformation of Message
objects as they are sent towards
the transport or host side. For
many codecs inheriting from AbstractSimpleCodec
may be more convenient than using this class directly, as it deals with batching of events and
ignoring messages with null payloads.
Subclasses should provide a constructor with the same signature as
AbstractCodec(org.slf4j.Logger, PluginConstructorParameters.CodecConstructorParameters)
.
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.
Logging should be performed using the ConnectivityPlugin.logger
field.
MapExtractor
can be used to extract the content of payload.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe next plug-in in the chain towards host, as set bysetNextTowardsHost(HostSide)
.The next plug-in in the chain towards transport, as set bysetNextTowardsTransport(TransportSide)
.Fields inherited from class com.softwareag.connectivity.ConnectivityPlugin
chainId, config, CONNECTIVITY_API_VERSION, host, logger, pluginName
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCodec
(org.slf4j.Logger logger, PluginConstructorParameters.CodecConstructorParameters params) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
No-op implementation ofConnectivityPlugin.hostReady()
.final void
setNextTowardsHost
(HostSide hostSide) Remember the host side of this codec.final void
setNextTowardsTransport
(TransportSide transportSide) Remember the transport side of this codec.void
shutdown()
No-op implementation ofConnectivityPlugin.shutdown()
.void
start()
No-op implementation ofConnectivityPlugin.start()
.toString()
Methods inherited from class com.softwareag.connectivity.ConnectivityPlugin
getStatusReporter
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.softwareag.connectivity.HostSide
sendBatchTowardsHost
Methods inherited from interface com.softwareag.connectivity.TransportSide
sendBatchTowardsTransport
-
Field Details
-
hostSide
The next plug-in in the chain towards host, as set bysetNextTowardsHost(HostSide)
. This field will be given a valid value before the start() method is called. -
transportSide
The next plug-in in the chain towards transport, as set bysetNextTowardsTransport(TransportSide)
. This field will be given a valid value before the start() method is called.
-
-
Constructor Details
-
AbstractCodec
public AbstractCodec(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
-
setNextTowardsHost
Remember the host side of this codec. The hostSide argument is stored in the hostSide member of this class for use by subclasses when delivering messages towards the transport. -
setNextTowardsTransport
Remember the transport side of this codec. The transportSide argument is stored in the transportSide member of this class for use by subclasses when delivering messages towards the host. -
shutdown
No-op implementation ofConnectivityPlugin.shutdown()
. For convenience. If the codec creates any resources that need closing, it must override this method.This method may be called while messages are still being delivered towards the host or towards the transport.
If the plug-in has any messages queued to send towards the host it should flush them before shutting down. This is not true if the host itself is shutting down (rather than just the chain). This can be determined via the
PluginHost.isShuttingDown()
method.- Specified by:
shutdown
in classConnectivityPlugin
- Throws:
Exception
-
start
No-op implementation ofConnectivityPlugin.start()
. For convenience. If the codec creates any resources, it will need to override this method to do so and will typically need to implementshutdown()
as well.- Specified by:
start
in classConnectivityPlugin
- Throws:
Exception
- only if a fatal error occurred during startup.
-
hostReady
No-op implementation ofConnectivityPlugin.hostReady()
. For convenience. Plug-ins are not required to do anything at this point, and most codecs will not need to implement this method.- Specified by:
hostReady
in classConnectivityPlugin
- Throws:
Exception
-
toString
-