diff options
Diffstat (limited to 'kamon-statsd/src/main/scala/kamon/statsd/client/StatsdClient.scala')
-rw-r--r-- | kamon-statsd/src/main/scala/kamon/statsd/client/StatsdClient.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdClient.scala b/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdClient.scala new file mode 100644 index 00000000..48940d05 --- /dev/null +++ b/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdClient.scala @@ -0,0 +1,22 @@ +package kamon.statsd.client + +import akka.actor.{ActorRef, Actor} +import akka.io.{Udp, IO} +import java.net.InetSocketAddress +import akka.util.ByteString + +class StatsdClient(remote: InetSocketAddress) extends Actor { + import context.system + + IO(Udp) ! Udp.SimpleSender + + def receive = { + case Udp.SimpleSenderReady => + context.become(ready(sender)) + } + + def ready(send: ActorRef): Receive = { + case msg: String => + send ! Udp.Send(ByteString(msg), remote) + } +}
\ No newline at end of file |