com.twitter.finagle.kestrel

MultiReaderThrift

object MultiReaderThrift

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 name: com.twitter.finagle.Name = Resolver.eval(...)
val va: Var[Addr] = name.bind()
val readHandle =
  MultiReaderThrift(va, "the-queue")
    .clientBuilder(
      ClientBuilder()
        .codec(MultiReaderThrift.codec(ClientId("myClientName"))
        .requestTimeout(1.minute)
        .connectTimeout(1.minute)
        .hostConnectionLimit(1) /* etc... but do not set hosts or build */
    .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 =
  MultiReaderThrift(va, "the-queue", ClientId("myClientName"))
    .retryBackoffs(/* Stream[Duration], Timer; optional */
    .build()
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MultiReaderThrift
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def apply(va: Var[Addr], queueName: String): MultiReaderBuilderThrift

    Used to create a thrift based MultiReader when a ClientId will neither not be provided or will be provided to the codec was part of creating a custom client builder.

    Used to create a thrift based MultiReader when a ClientId will neither not be provided or will be provided to the codec was part of creating a custom client builder. This is provided as a separate method for Java compatability.

    va

    endpoints for Kestrel

    queueName

    the name of the queue to read from

    returns

    A MultiReaderBuilderThrift

  7. def apply(va: Var[Addr], queueName: String, clientId: Option[ClientId]): MultiReaderBuilderThrift

    Used to create a thrift based MultiReader with a ClientId when a custom client builder will not be used.

    Used to create a thrift based MultiReader with a ClientId when a custom client builder will not be used. If a custom client builder will be used then it is more reasonable to use the version of apply that does not take a ClientId or else the client id will need to be passed to both apply and the codec in clientBuilder.

    va

    endpoints for Kestrel

    queueName

    the name of the queue to read from

    clientId

    the clientid to be used

    returns

    A MultiReaderBuilderThrift

  8. def apply(dest: Name, queueName: String, clientId: Option[ClientId]): MultiReaderBuilderThrift

    Used to create a thrift based MultiReader with a ClientId when a custom client builder will not be used.

    Used to create a thrift based MultiReader with a ClientId when a custom client builder will not be used. If a custom client builder will be used then it is more reasonable to use the version of apply that does not take a ClientId or else the client id will need to be passed to both apply and the codec in clientBuilder.

    dest

    a com.twitter.finagle.Name representing the Kestrel endpoints to connect to

    queueName

    the name of the queue to read from

    clientId

    the clientid to be used

    returns

    A MultiReaderBuilderThrift

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def codec(clientId: ClientId): ThriftClientFramedCodecFactory

    Helper for getting the right codec for the thrift protocol

    Helper for getting the right codec for the thrift protocol

    returns

    the ThriftClientFramedCodec codec

  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped