Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import net.gutefrage.temperature.thrift._
import com.twitter.finagle.ThriftMux
// this is the raw implementation with the twitter Future based API
val service = new TemperatureService.FutureIface {
override def add(datum: TemperatureDatum): Future[Unit] = ???
override def mean(): Future[Double] = ???
}
// scrooge generates class to wrap a thrift service into a finagle compatible service definition
val finagledService = new TemperatureService.FinagledService(
service, Protocols.binaryFactory()
)
// run and announce the server
val server = ThriftMux.server
.withLabel("temperature-service")
.serveAndAnnounce(
// static announcemnt via zookeeper
name = "zk!127.0.0.1:2181!/service/temperature!0",
// bind this service to this address
addr = ":8082",
// the service to announce
service = finagledService
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment