public abstract class AbstractEventTransport extends java.lang.Object implements EventTransport
In addition to implementing the abstract methods here and in the EventTransport interface, valid subclasses must provide a constructor with the same signature as the one provided here. Note that the IAF provides NO guarantees about what threads that will be used to call these functions, so to ensure correct operation care must be taken to use locking where required.
API_VERSION
Constructor and Description |
---|
AbstractEventTransport(java.lang.String name,
EventTransportProperty[] properties,
TimestampConfig timestampConfig)
Construct a new instance of AbstractEventTransport.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addEventDecoder(java.lang.String name,
EventDecoder decoder)
Add a named event decoder to the set of decoders known to the
transport.
|
abstract void |
cleanup()
Frees any resources allocated by the transport (useful for resources
external to the JVM that were allocated in the constructor).
|
void |
flushDownstream()
Flush any pending transport events into the decoder.
|
void |
flushUpstream()
Flush any pending normalized events onto the external transport.
|
abstract int |
getAPIVersion()
Return the transport API version that the transport was built against.
|
int |
getCapabilities()
Return the capabilities of the transport.
|
abstract TransportStatus |
getStatus()
Return a
TransportStatus or ExtendedTransportStatus
object containing up-to-date status information for the transport. |
abstract void |
removeEventDecoder(java.lang.String name)
Remove a named event decoder from the set of decoders known to the
transport.
|
abstract void |
sendTransportEvent(java.lang.Object event,
TimestampSet timestamps)
Called by an event encoder to send an upstream message to the external
transport.
|
abstract void |
start()
Establish a connection and start processing incoming data from the
external transport.
|
abstract void |
stop()
Stop processing incoming data from the external transport, typically
by pausing or closing down connections.
|
java.lang.String |
toString() |
void |
updateProperties(EventTransportProperty[] properties,
TimestampConfig timestampConfig)
Update the configuration of the transport.
|
public AbstractEventTransport(java.lang.String name, EventTransportProperty[] properties, TimestampConfig timestampConfig) throws TransportException
The AbstractEventTransport implementation does nothing, but subclasses should make use of the arguments to initialize the transport.
name
- The transport name, as specified in the IAF config fileproperties
- The transport property set specified in the IAF
configuration filetimestampConfig
- Timestamp recording/logging settings from the
IAF configuration fileTransportException
public void updateProperties(EventTransportProperty[] properties, TimestampConfig timestampConfig) throws TransportException
properties
- The new transport property set specified in the IAF
configuration filetimestampConfig
- Timestamp recording/logging settingsTransportException
public abstract void addEventDecoder(java.lang.String name, EventDecoder decoder) throws TransportException
name
- The name of the decoder to be addeddecoder
- The decoder object instanceTransportException
public abstract void removeEventDecoder(java.lang.String name) throws TransportException
name
- The decoder to be removedTransportException
public void flushUpstream() throws TransportException
TransportException
public void flushDownstream() throws TransportException
TransportException
public abstract void start() throws TransportException
An adapter should send events to the correlator only after its start() method is called and before the stop() method returns. Therefore we strongly recommend that a transport should not change to a state where it is possible to receive events from any external transport until the start() method has been called. In many cases, adapters will also need to communicate with service monitors in the correlator to ensure that the required monitors and event definitions are injected before they begin to process messages from the external system. This is necessary in order to avoid events from the adapter being lost if the correlator is not yet ready to parse and process them.
TransportException
public abstract void stop() throws TransportException
Adapter authors must ensure that no events are sent to the Correlator after stop() has returned (the only exception being rare cases where the transport sends buffered events in the Correlator in the flushDownstream() method, which is called by the IAF after stop()). If necessary any messages that are unavoidably received from the transport after stop() has returned should be blocked, queued or simply dropped.
TransportException
public abstract void cleanup() throws TransportException
TransportException
public abstract TransportStatus getStatus()
TransportStatus
or ExtendedTransportStatus
object containing up-to-date status information for the transport.public abstract int getAPIVersion()
EventTransport.API_VERSION
.public int getCapabilities()
0
.public java.lang.String toString()
toString
in class java.lang.Object
public abstract void sendTransportEvent(java.lang.Object event, TimestampSet timestamps) throws TransportException
EventTransport
It is assumed that the encoder and transport share the same definition of the content of the event, so that the transport can effectively interpret the event.
sendTransportEvent
in interface EventTransport
event
- An object representing the event to be sent by the
transport, in a format shared by the encoder and transport.timestamps
- A TimestampSet representing the timestamps attached
to the event.TransportException
- Thrown by the transport if any error occurs
sending the message.Submit a bug or feature
Copyright (c) 2013-2018 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.