benmur / riemann-scala-client

Scala client library for sending events to Riemann
MIT License
19 stars 7 forks source link

Minimum viable use case does not compile #10

Closed chesterhemmer closed 9 years ago

chesterhemmer commented 9 years ago

The following class, taken from the "Minimum viable use case" does not compile. Errors are below.
Using 0.3.3-SNAPSHOT.

package com.example.myproject

import net.benmur.riemann.client._
//import net.benmur.riemann.client.EventSenderDSL._
import RiemannClient._

import akka.actor.ActorSystem
import akka.util.Timeout

import java.net.InetSocketAddress
import java.util.concurrent.TimeUnit._

import com.twitter.inject.Logging

/**
 * Riemann proxy client.
 */
object Metrics extends Logging
{
  private implicit val system = ActorSystem()
  private implicit def timeout = Timeout(5, SECONDS)

  val metrics = riemannConnectAs[Unreliable] to new InetSocketAddress("localhost", 5555)
  service("service name") | state("warning") |>> metrics
}

compile [info] Compiling 9 Scala sources to /.../target/scala-2.11/classes... [error] /.../Metrics.scala:23: value |>> is not a member of net.benmur.riemann.client.EventPart [error] service("service name") | state("warning") |>> metrics [error] ^ [error] one error found error Compilation failed [error] Total time: 2 s, completed Jul 22, 2015 10:56:48 AM

benmur commented 9 years ago

Thanks for reporting - I updated the README with a complete example.

This was due to scala 2.11 not picking any implicits anymore when more than one candidate is available. I'll add some ReliableClient and UnreliableClient objects to import all implicits from, which won't collide.