Package com.softwareag.connectivity
Class AbstractSimpleTransport
java.lang.Object
com.softwareag.connectivity.ConnectivityPlugin
com.softwareag.connectivity.AbstractTransport
com.softwareag.connectivity.AbstractSimpleTransport
- All Implemented Interfaces:
TransportSide
Base class that allows simplified implementation of transport plug-ins.
Handles batches of messages and ignoring null payload messages (by
default). Plug-in authors will typically extend this class,
providing a valid constructor, an implementation of
deliverMessageTowardsTransport(Message)
,
and calling HostSide.sendBatchTowardsHost(List)
to send messages in the other direction.
Subclasses should provide a constructor with the same signature as
AbstractSimpleTransport(org.slf4j.Logger, PluginConstructorParameters.TransportConstructorParameters)
.
-
Field Summary
Fields inherited from class com.softwareag.connectivity.AbstractTransport
hostSide
Fields inherited from class com.softwareag.connectivity.ConnectivityPlugin
chainId, config, CONNECTIVITY_API_VERSION, host, logger, pluginName
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSimpleTransport
(org.slf4j.Logger logger, PluginConstructorParameters.TransportConstructorParameters params) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
deliverMessageTowardsTransport
(Message message) Deliver an individual non-null message.void
Deliver an individual null-payload message.void
handleException
(Exception ex, Message message, boolean towardsTransport) Handle exception thrown from delivering messages.void
sendBatchTowardsTransport
(List<Message> messages) Deliver a batch of messages and pass them on to the next plug-in synchronously.Methods inherited from class com.softwareag.connectivity.AbstractTransport
hostReady, setNextTowardsHost, shutdown, start, toString
Methods inherited from class com.softwareag.connectivity.ConnectivityPlugin
getStatusReporter
-
Constructor Details
-
AbstractSimpleTransport
public AbstractSimpleTransport(org.slf4j.Logger logger, PluginConstructorParameters.TransportConstructorParameters 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
Deliver a batch of messages and pass them on to the next plug-in synchronously. For each message passed in, calls deliverMessageTowardsTransport or deliverNullPayloadTowardsTransport (if the payload was null). On an exception, call handleException.If the transport can deliver multiple events in a batch more efficiently, then it should override this method.
-
deliverMessageTowardsTransport
Deliver an individual non-null message. If this method throws then the exception will be logged and the message dropped.- Throws:
Exception
-
deliverNullPayloadTowardsTransport
Deliver an individual null-payload message. By convention, most plug-ins silently ignore messages with null payloads without delivering them. Thus, the default implementation of this method is a no-op.- Throws:
Exception
-
handleException
Handle exception thrown from delivering messages. The default implementation is to only log (thus discarding this message, but not others in the same batch)
-