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".AsyncPolicygetAsyncPolicy()Defines how messages should be asynchronously dispatched.DistPollerDaogetDistPollerDao()StringgetId()Globally unique identifier.intgetNumConsumerThreads()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.voidsetDistPollerDao(DistPollerDao distPollerDao)TelemetryProtos.TelemetryMessageLogunmarshal(byte[] bytes)Unmarshals the aggregated message from a byte array.TelemetryMessageunmarshalSingleMessage(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:SinkModuleGlobally unique identifier. Used in the JMS queue name in the Camel implementation.- Specified by:
getIdin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
getNumConsumerThreads
public int getNumConsumerThreads()
Description copied from interface:SinkModuleThe number of threads used to consume from the broker.- Specified by:
getNumConsumerThreadsin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
marshal
public byte[] marshal(TelemetryProtos.TelemetryMessageLog message)
Description copied from interface:SinkModuleMarshals the aggregated message to a byte array.- Specified by:
marshalin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
unmarshal
public TelemetryProtos.TelemetryMessageLog unmarshal(byte[] bytes)
Description copied from interface:SinkModuleUnmarshals the aggregated message from a byte array.- Specified by:
unmarshalin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
marshalSingleMessage
public byte[] marshalSingleMessage(TelemetryMessage message)
Description copied from interface:SinkModuleMarshals single message to a byte array.- Specified by:
marshalSingleMessagein interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
unmarshalSingleMessage
public TelemetryMessage unmarshalSingleMessage(byte[] message)
Description copied from interface:SinkModuleUnmarshals single message from a byte array.- Specified by:
unmarshalSingleMessagein interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>
-
getAggregationPolicy
public AggregationPolicy<TelemetryMessage,TelemetryProtos.TelemetryMessageLog,TelemetryProtos.TelemetryMessageLog.Builder> getAggregationPolicy()
Description copied from interface:SinkModuleDefines how messages should be combined, and when they should be "released". Modules that do not wish to use aggregation can returnnull.- Specified by:
getAggregationPolicyin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>- Returns:
- the
AggregationPolicyused to combine messages, ornullif the messages should not be combined.
-
getAsyncPolicy
public AsyncPolicy getAsyncPolicy()
Description copied from interface:SinkModuleDefines how messages should be asynchronously dispatched.- Specified by:
getAsyncPolicyin interfaceSinkModule<TelemetryMessage,TelemetryProtos.TelemetryMessageLog>- Returns:
- the
AsyncPolicyused when asynchronously dispatching messages for this module.
-
getRoutingKey
public Optional<String> getRoutingKey(TelemetryProtos.TelemetryMessageLog message)
Description copied from interface:SinkModuleThr routing key will be used to ensure all messages of the same group is handled by the same consumer.- Specified by:
getRoutingKeyin 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)
-
-