Class Connection

java.lang.Object
akka.actor.AbstractActor
com.arpnetworking.metrics.proxy.actors.Connection
All Implemented Interfaces:
akka.actor.Actor

public class Connection extends akka.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 akka.actor.AbstractActor

    akka.actor.AbstractActor.ActorContext, akka.actor.AbstractActor.Receive

    Nested classes/interfaces inherited from interface akka.actor.Actor

    akka.actor.Actor.emptyBehavior$, akka.actor.Actor.ignoringBehavior$
  • Constructor Summary

    Constructors
    Constructor
    Description
    Connection(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory processorsFactory)
    Public constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    akka.actor.AbstractActor.Receive
     
    akka.actor.ActorRef
    Accessor to this Connection's Telemetry actor.
    static akka.actor.Props
    props(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory messageProcessorsFactory)
    Factory for creating a Props 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(String service, String metric, String statistic)
    Subscribe the connection to a stream.
    Generate a Steno log compatible representation.
     
    void
    unsubscribe(String service, String metric, String statistic)
    Unsubscribe the connection from a stream.

    Methods inherited from class akka.actor.AbstractActor

    akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, emptyBehavior, getContext, getSelf, getSender, postRestart, postStop, preRestart, preRestart, preStart, receive, receiveBuilder, self, sender, supervisorStrategy, unhandled

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Connection

      public Connection(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory processorsFactory)
      Public constructor.
      Parameters:
      metrics - Instance of PeriodicMetrics.
      processorsFactory - Factory for producing the protocol's MessagesProcessor
  • Method Details

    • props

      public static akka.actor.Props props(com.arpnetworking.metrics.incubator.PeriodicMetrics metrics, MessageProcessorsFactory messageProcessorsFactory)
      Factory for creating a Props with strong typing.
      Parameters:
      metrics - Instance of PeriodicMetrics.
      messageProcessorsFactory - Factory to create a MessagesProcessor object.
      Returns:
      a new Props object to create a Connection actor.
    • createReceive

      public akka.actor.AbstractActor.Receive createReceive()
      Specified by:
      createReceive in class akka.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

      public void sendCommand(String command, com.fasterxml.jackson.databind.node.ObjectNode data)
      Sends a command object to the connected client.
      Parameters:
      command - The command.
      data - The data for the command.
    • subscribe

      public void subscribe(String service, String metric, String statistic)
      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

      public void unsubscribe(String service, String metric, String statistic)
      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 akka.actor.ActorRef getTelemetry()
      Accessor to this Connection's Telemetry actor.
      Returns:
      This Connection's Telemetry actor.
    • toLogValue

      public Object toLogValue()
      Generate a Steno log compatible representation.
      Returns:
      Steno log compatible representation.
    • toString

      public String toString()
      Overrides:
      toString in class Object