A friendly Kestrel client Interface.
Common base class for clients using different protocols
Common base class for clients using different protocols
the type that executes commands using some protocol
the type of reply that {{CommandExecutor}} returns
the type used by {{CommandExecutor}} to identify returned items
Factory of command executors for com.twitter.finagle.kestrel.ClientBase
Factory of command executors for com.twitter.finagle.kestrel.ClientBase
the type used to execute commands in com.twitter.finagle.kestrel.ClientBase.read
A Client representing a single TCP connection to a single server.
A Client representing a single TCP connection to a single server.
Wrapper factory for creating FinagledClosableClients
Wrapper factory for creating FinagledClosableClients
Extends FinagledClient with Closable
Extends FinagledClient with Closable
Factory for com.twitter.finagle.kestrel.ReadHandle instances.
Factory for com.twitter.finagle.kestrel.ReadHandle instances using Kestrel's memcache protocol.
Factory for com.twitter.finagle.kestrel.ReadHandle instances using Kestrel's thriftmux protocol.
Factory for com.twitter.finagle.kestrel.ReadHandle instances using Kestrel's thriftmux protocol.
Multi reader configuration settings
An ongoing transactional read (from {{read}}).
An ongoing transactional read (from {{read}}).
A common usage pattern is to attach asynchronous handlers to messages
and error
by invoking Offer.foreach
on them. For example:
val readHandle: ReadHandle = ... readHandle.messages.foreach { msg => try { System.out.println(msg.bytes.toString("UTF-8")) } finally { msg.ack() // if we don't do this, no more msgs will come to us } } readHandle.error.foreach { System.error.println("zomg! got an error " + _.getMessage) }
A message that has been read: consists of the message itself, and an offer to acknowledge.
A Client representing a single TCP connection to a single server using thrift.
A Client representing a single TCP connection to a single server using thrift.
(Since version 6.15.1) Use MultiReaderBuilderMemcache instead
(Since version 6.15.1) Use MultiReaderConfig[Req, Rep] instead
Indicates that all ReadHandles that are backing a given com.twitter.finagle.kestrel.MultiReader have died.
Read from multiple clients in round-robin fashion, "grabby hands" style using Kestrel's memcache protocol.
Read from multiple clients in round-robin fashion, "grabby hands" style using Kestrel's memcache protocol. The load balancing is simple, and falls out naturally from the user of the {{Offer}} mechanism: When there are multiple available messages, round-robin across them. Otherwise, wait for the first message to arrive.
Example with a custom client builder:
val readHandle = MultiReaderMemcache("/the/path", "the-queue") .clientBuilder( ClientBuilder() /* etc... but do not set hosts or build */ .stack(Kestrel.client .withSession.acquisitionTimeout(1.minute) .withRequestTimeout(1.minute) .withSessionPool.maxValue(1))) .retryBackoffs(/* Stream[Duration], Timer; optional */) .build()
Read from multiple clients in round-robin fashion, "grabby hands" style using Kestrel's memcache protocol.
Read from multiple clients in round-robin fashion, "grabby hands" style using Kestrel's memcache protocol. The load balancing is simple, and falls out naturally from the user of the {{Offer}} mechanism: When there are multiple available messages, round-robin across them. Otherwise, wait for the first message to arrive.
Example with a custom client builder:
val readHandle = MultiReaderThriftMux("/the/path", "the-queue") .clientBuilder( ClientBuilder() .stack(ThriftMux.client .withClientId(ClientId("myClientName")) .withSession.acquisitionTimeout(1.minute) .withRequestTimeout(1.minute)) .retryBackoffs(/* Stream[Duration], Timer; optional */) .build()
Example without a customer client builder so clientId passed to apply
val name: com.twitter.finagle.Name = Resolver.eval(...) val va: Var[Addr] = name.bind() val readHandle = MultiReaderThriftMux(va, "the-queue", ClientId("myClientName")) .retryBackoffs(/* Stream[Duration], Timer; optional */) .build()
Indicates that a com.twitter.finagle.kestrel.ReadHandle has exceeded its retry budget.
Indicates that a com.twitter.finagle.kestrel.ReadHandle has been closed.
Read from multiple clients in round-robin fashion, "grabby hands" style.
Read from multiple clients in round-robin fashion, "grabby hands" style. The load balancing is simple, and falls out naturally from the user of the {{Offer}} mechanism: When there are multiple available messages, round-robin across them. Otherwise, wait for the first message to arrive.
Var[Addr] example:
val name: com.twitter.finagle.Name = Resolver.eval(...) val va: Var[Addr] = name.bind() val readHandle = MultiReader(va, "the-queue") .clientBuilder( ClientBuilder() /* etc... but do not set hosts or build */ .stack(Kestrel.client .withSession.acquisitionTimeout(1.minute) .withRequestTimeout(1.minute) .withSessionPool.maxSize(1))) .retryBackoffs(/* Stream[Duration], Timer; optional */) .build()
(Since version 6.15.1) Use MultiReaderMemcache or MultiReaderThriftMux instead