Package org.opennms.core.ipc.sink.api
Interface SinkModule<S extends Message,T extends Message>
-
- Type Parameters:
S
- type of message that will be sent by the producersT
- type of message that will be received by the consumers
- All Known Implementing Classes:
AbstractXmlSinkModule
,EventSinkModule
,HeartbeatModule
,MockSinkModule
,SyslogSinkModule
,TelemetrySinkModule
,TrapSinkModule
public interface SinkModule<S extends Message,T extends Message>
Defines how the messages will be routed and marshaled/unmarshaled over the wire. Messages can be aggregated by an optionalAggregationPolicy
. If aggregation is not used, the message type sent by the producers must match the message type received by the consumers.- Author:
- jwhite
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HEARTBEAT_MODULE_ID
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AggregationPolicy<S,T,?>
getAggregationPolicy()
Defines how messages should be combined, and when they should be "released".AsyncPolicy
getAsyncPolicy()
Defines how messages should be asynchronously dispatched.java.lang.String
getId()
Globally unique identifier.int
getNumConsumerThreads()
The number of threads used to consume from the broker.default java.util.Optional<java.lang.String>
getRoutingKey(T message)
Thr routing key will be used to ensure all messages of the same group is handled by the same consumer.byte[]
marshal(T message)
Marshals the aggregated message to a byte array.byte[]
marshalSingleMessage(S message)
Marshals single message to a byte array.T
unmarshal(byte[] message)
Unmarshals the aggregated message from a byte array.S
unmarshalSingleMessage(byte[] message)
Unmarshals single message from a byte array.
-
-
-
Field Detail
-
HEARTBEAT_MODULE_ID
static final java.lang.String HEARTBEAT_MODULE_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
java.lang.String getId()
Globally unique identifier. Used in the JMS queue name in the Camel implementation.
-
getNumConsumerThreads
int getNumConsumerThreads()
The number of threads used to consume from the broker.
-
marshal
byte[] marshal(T message)
Marshals the aggregated message to a byte array.
-
unmarshal
T unmarshal(byte[] message)
Unmarshals the aggregated message from a byte array.
-
marshalSingleMessage
byte[] marshalSingleMessage(S message)
Marshals single message to a byte array.
-
unmarshalSingleMessage
S unmarshalSingleMessage(byte[] message)
Unmarshals single message from a byte array.
-
getAggregationPolicy
AggregationPolicy<S,T,?> getAggregationPolicy()
Defines how messages should be combined, and when they should be "released". Modules that do not wish to use aggregation can returnnull
.- Returns:
- the
AggregationPolicy
used to combine messages, ornull
if the messages should not be combined.
-
getAsyncPolicy
AsyncPolicy getAsyncPolicy()
Defines how messages should be asynchronously dispatched.- Returns:
- the
AsyncPolicy
used when asynchronously dispatching messages for this module.
-
getRoutingKey
default java.util.Optional<java.lang.String> getRoutingKey(T message)
Thr routing key will be used to ensure all messages of the same group is handled by the same consumer.- Parameters:
message
- the message to generate the routing key from- Returns:
- the routing key or,
Optional.empty()
if no routing is required
-
-