Class Connection
java.lang.Object
org.apache.pekko.actor.AbstractActor
com.arpnetworking.metrics.proxy.actors.Connection
- All Implemented Interfaces:
org.apache.pekko.actor.Actor
public class Connection
extends org.apache.pekko.actor.AbstractActor
Actor class to hold the state for a single connection.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot io)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.actor.AbstractActor
org.apache.pekko.actor.AbstractActor.ActorContext, org.apache.pekko.actor.AbstractActor.Receive
Nested classes/interfaces inherited from interface org.apache.pekko.actor.Actor
org.apache.pekko.actor.Actor.emptyBehavior$, org.apache.pekko.actor.Actor.ignoringBehavior$
-
Constructor Summary
ConstructorDescriptionConnection
(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory processorsFactory) Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pekko.actor.AbstractActor.Receive
org.apache.pekko.actor.ActorRef
Accessor to this Connection's Telemetry actor.static org.apache.pekko.actor.Props
props
(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory messageProcessorsFactory) Factory for creating aProps
with strong typing.void
send
(com.fasterxml.jackson.databind.node.ObjectNode message) Sends a json object to the connected client.void
sendCommand
(String command, com.fasterxml.jackson.databind.node.ObjectNode data) Sends a command object to the connected client.void
Subscribe the connection to a stream.Generate a Steno log compatible representation.toString()
void
unsubscribe
(String service, String metric, String statistic) Unsubscribe the connection from a stream.Methods inherited from class org.apache.pekko.actor.AbstractActor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, emptyBehavior, getContext, getSelf, getSender, org$apache$pekko$actor$Actor$_setter_$context_$eq, org$apache$pekko$actor$Actor$_setter_$self_$eq, postRestart, postStop, preRestart, preRestart, preStart, receive, receiveBuilder, self, sender, supervisorStrategy, unhandled
-
Constructor Details
-
Connection
public Connection(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory processorsFactory) Public constructor.- Parameters:
metrics
- Instance ofPeriodicMetrics
.processorsFactory
- Factory for producing the protocol'sMessagesProcessor
-
-
Method Details
-
props
public static org.apache.pekko.actor.Props props(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory messageProcessorsFactory) Factory for creating aProps
with strong typing.- Parameters:
metrics
- Instance ofPeriodicMetrics
.messageProcessorsFactory
- Factory to create aMessagesProcessor
object.- Returns:
- a new Props object to create a
Connection
actor.
-
createReceive
public org.apache.pekko.actor.AbstractActor.Receive createReceive()- Specified by:
createReceive
in classorg.apache.pekko.actor.AbstractActor
-
send
public void send(com.fasterxml.jackson.databind.node.ObjectNode message) Sends a json object to the connected client.- Parameters:
message
- The message to send.
-
sendCommand
Sends a command object to the connected client.- Parameters:
command
- The command.data
- The data for the command.
-
subscribe
Subscribe the connection to a stream.- Parameters:
service
- The service to subscribe to.metric
- The metric to subscribe to.statistic
- The statistic to subscribe to.
-
unsubscribe
Unsubscribe the connection from a stream.- Parameters:
service
- The service to unsubscribe from.metric
- The metric to unsubscribe from.statistic
- The statistic to unsubscribe from.
-
getTelemetry
public org.apache.pekko.actor.ActorRef getTelemetry()Accessor to this Connection's Telemetry actor.- Returns:
- This Connection's Telemetry actor.
-
toLogValue
Generate a Steno log compatible representation.- Returns:
- Steno log compatible representation.
-
toString
-