Package com.arpnetworking.tsdcore.sinks
Class TcpSink
java.lang.Object
com.arpnetworking.tsdcore.sinks.BaseSink
com.arpnetworking.tsdcore.sinks.TcpSink
- All Implemented Interfaces:
Sink
- Direct Known Subclasses:
CarbonSink
Abstract publisher to send data to a server via Pekko TCP channel.
This class leverages a TcpSinkActor to interact with the TCP channel.
- Author:
- Brandon Arp (brandonarp at gmail dot com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
TcpSink.Builder<B extends BaseSink.Builder<B,
S>, S extends TcpSink> Implementation of base builder pattern forTcpSink
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TcpSink
(TcpSink.Builder<?, ?> builder) Protected constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Called to allow the publisher to clean-up.void
Called when additionalPeriodicData
instances are available for publication.protected abstract org.apache.pekko.util.ByteString
serializeData
(PeriodicData periodicData) Serialize aPeriodicData
to binary.Called to allow the publisher to clean-up.protected void
start
(TcpSink.Builder<?, ?> builder) Starts the actor for the sink.Generate a Steno log compatible representation.Methods inherited from class com.arpnetworking.tsdcore.sinks.BaseSink
getMetricSafeName, getName, toString
-
Constructor Details
-
TcpSink
Protected constructor.- Parameters:
builder
- Instance ofTcpSink.Builder
.
-
-
Method Details
-
close
public void close()Called to allow the publisher to clean-up. No further calls to recordAggregation will be made after a call to close. -
shutdownGracefully
Description copied from interface:Sink
Called to allow the publisher to clean-up. No further calls to recordAggregation will be made after a call to close.- Returns:
- A
CompletionStage
that completes when the sink is closed.
-
toLogValue
Generate a Steno log compatible representation.- Overrides:
toLogValue
in classBaseSink
- Returns:
- Steno log compatible representation.
-
recordAggregateData
Called when additionalPeriodicData
instances are available for publication.- Parameters:
data
- The {PeriodicData
to be published.
-
serializeData
Serialize aPeriodicData
to binary.- Parameters:
periodicData
- Data to serialize.- Returns:
ByteString
representing the periodicData.
-
start
Starts the actor for the sink. This is necessary to prevent references to 'this' from escaping the constructor.- Parameters:
builder
- The builder used to create the sink.
-