Class TelemetrySinkModule
- java.lang.Object
-
- org.opennms.netmgt.telemetry.common.ipc.TelemetrySinkModule
-
- All Implemented Interfaces:
SinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
public class TelemetrySinkModule extends Object implements SinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
-
Field Summary
-
Fields inherited from interface org.opennms.core.ipc.sink.api.SinkModule
HEARTBEAT_MODULE_ID
-
-
Constructor Summary
Constructors Constructor Description TelemetrySinkModule(QueueDefinition queueConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AggregationPolicy<TelemetryMessage,TelemetryProtos.TelemetryMessageLog,TelemetryProtos.TelemetryMessageLog.Builder>
getAggregationPolicy()
Defines how messages should be combined, and when they should be "released".AsyncPolicy
getAsyncPolicy()
Defines how messages should be asynchronously dispatched.DistPollerDao
getDistPollerDao()
String
getId()
Globally unique identifier.int
getNumConsumerThreads()
The number of threads used to consume from the broker.Optional<String>
getRoutingKey(TelemetryProtos.TelemetryMessageLog message)
Thr routing key will be used to ensure all messages of the same group is handled by the same consumer.byte[]
marshal(TelemetryProtos.TelemetryMessageLog message)
Marshals the aggregated message to a byte array.byte[]
marshalSingleMessage(TelemetryMessage message)
Marshals single message to a byte array.void
setDistPollerDao(DistPollerDao distPollerDao)
TelemetryProtos.TelemetryMessageLog
unmarshal(byte[] bytes)
Unmarshals the aggregated message from a byte array.TelemetryMessage
unmarshalSingleMessage(byte[] message)
Unmarshals single message from a byte array.
-
-
-
Constructor Detail
-
TelemetrySinkModule
public TelemetrySinkModule(QueueDefinition queueConfig)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:SinkModule
Globally unique identifier. Used in the JMS queue name in the Camel implementation.- Specified by:
getId
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
getNumConsumerThreads
public int getNumConsumerThreads()
Description copied from interface:SinkModule
The number of threads used to consume from the broker.- Specified by:
getNumConsumerThreads
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
marshal
public byte[] marshal(TelemetryProtos.TelemetryMessageLog message)
Description copied from interface:SinkModule
Marshals the aggregated message to a byte array.- Specified by:
marshal
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
unmarshal
public TelemetryProtos.TelemetryMessageLog unmarshal(byte[] bytes)
Description copied from interface:SinkModule
Unmarshals the aggregated message from a byte array.- Specified by:
unmarshal
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
marshalSingleMessage
public byte[] marshalSingleMessage(TelemetryMessage message)
Description copied from interface:SinkModule
Marshals single message to a byte array.- Specified by:
marshalSingleMessage
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
unmarshalSingleMessage
public TelemetryMessage unmarshalSingleMessage(byte[] message)
Description copied from interface:SinkModule
Unmarshals single message from a byte array.- Specified by:
unmarshalSingleMessage
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
getAggregationPolicy
public AggregationPolicy<TelemetryMessage,TelemetryProtos.TelemetryMessageLog,TelemetryProtos.TelemetryMessageLog.Builder> getAggregationPolicy()
Description copied from interface:SinkModule
Defines how messages should be combined, and when they should be "released". Modules that do not wish to use aggregation can returnnull
.- Specified by:
getAggregationPolicy
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
- Returns:
- the
AggregationPolicy
used to combine messages, ornull
if the messages should not be combined.
-
getAsyncPolicy
public AsyncPolicy getAsyncPolicy()
Description copied from interface:SinkModule
Defines how messages should be asynchronously dispatched.- Specified by:
getAsyncPolicy
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
- Returns:
- the
AsyncPolicy
used when asynchronously dispatching messages for this module.
-
getRoutingKey
public Optional<String> getRoutingKey(TelemetryProtos.TelemetryMessageLog message)
Description copied from interface:SinkModule
Thr routing key will be used to ensure all messages of the same group is handled by the same consumer.- Specified by:
getRoutingKey
in interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
- Parameters:
message
- the message to generate the routing key from- Returns:
- the routing key or,
Optional.empty()
if no routing is required
-
getDistPollerDao
public DistPollerDao getDistPollerDao()
-
setDistPollerDao
public void setDistPollerDao(DistPollerDao distPollerDao)
-
-