com.metamx.tranquility.tranquilizer

Tranquilizer

class Tranquilizer[MessageType] extends Service[MessageType, Unit] with Logging

Tranquilizers allow you to provide single messages and get a future for each message reporting success or failure. Tranquilizers provide batching and backpressure, unlike Beams which require you to batch messages on your own and do not provide backpressure.

The expected use case of this class is to send individual messages efficiently, possibly from multiple threads, and receive success or failure information for each message. This class is thread-safe.

To create Tranquilizers, use Tranquilizer$.create, Tranquilizer$.builder, or com.metamx.tranquility.druid.DruidBeams$$Builder#buildTranquilizer.

Linear Supertypes
Logging, Service[MessageType, Unit], Closable, (MessageType) ⇒ Future[Unit], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Tranquilizer
  2. Logging
  3. Service
  4. Closable
  5. Function1
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class MessageHolder(message: MessageType, future: Promise[Unit]) extends Product with Serializable

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 andThen[A](g: (Future[Unit]) ⇒ A): (MessageType) ⇒ A

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  7. def apply(message: MessageType): Future[Unit]

    Same as Tranquilizer.send.

    message

    the message to send

    returns

    a future that resolves when the message is sent

    Definition Classes
    Tranquilizer → Service → Function1
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def close(deadline: Time): Future[Unit]

    Stop the tranquilizer, and close the underlying Beam.

    Stop the tranquilizer, and close the underlying Beam.

    Definition Classes
    Tranquilizer → Service → Closable
  11. def close(after: Duration): Future[Unit]

    Definition Classes
    Closable
  12. final def close(): Future[Unit]

    Definition Classes
    Closable
  13. def compose[A](g: (A) ⇒ MessageType): (A) ⇒ Future[Unit]

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  14. final def eq(arg0: AnyRef): Boolean

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

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

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

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

    Definition Classes
    AnyRef → Any
  19. final def isAvailable: Boolean

    Definition Classes
    Service
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. lazy val log: Logger

    Definition Classes
    Logging
  22. def map[Req1](f: (Req1) ⇒ MessageType): Service[Req1, Unit]

    Definition Classes
    Service
  23. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  26. def send(message: MessageType): Future[Unit]

    Sends a message.

    Sends a message. Generally asynchronous, but will block to provide backpressure if the internal buffer is full.

    The future may contain a Unit, in which case the message was successfully sent. Or it may contain an exception, in which case the message may or may not have been successfully sent. One specific exception to look out for is MessageDroppedException, which means that a message was dropped due to unrecoverable reasons. With Druid this can be caused by message timestamps being outside the configured windowPeriod.

    message

    message to send

    returns

    future that resolves when the message is sent, or fails to send

  27. def simple(reportDropsAsExceptions: Boolean = false): SimpleTranquilizerAdapter[MessageType]

    Create a SimpleTranquilizerAdapter based on this Tranquilizer.

    Create a SimpleTranquilizerAdapter based on this Tranquilizer. You can create multiple adapters based on the same Tranquilizer, and even use them simultaneously.

    reportDropsAsExceptions

    true if the adapter should report message drops as exceptions. Otherwise, drops are ignored (but will still be reflected in the counters).

    returns

    a simple adapter

  28. def start(): Unit

    Start the tranquilizer.

    Start the tranquilizer. Must be called before any calls to "send" or "apply".

    Annotations
    @LifecycleStart()
  29. def status: Status

    Definition Classes
    Service
  30. def stop(): Unit

    Stop the tranquilizer, and close the underlying Beam.

    Stop the tranquilizer, and close the underlying Beam. Blocks until closed. Generally you should either use this method or Tranquilizer.close, but not both.

    Annotations
    @LifecycleStop()
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  32. def toString(): String

    Definition Classes
    Tranquilizer → Function1 → AnyRef → Any
  33. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. final def release(): Unit

    Definition Classes
    Service
    Annotations
    @deprecated
    Deprecated

    (Since version 7.0.0) Use close() instead

Inherited from Logging

Inherited from Service[MessageType, Unit]

Inherited from Closable

Inherited from (MessageType) ⇒ Future[Unit]

Inherited from AnyRef

Inherited from Any

Ungrouped