Class/Object

com.metamx.tranquility.tranquilizer

Tranquilizer

Related Docs: object Tranquilizer | package tranquilizer

Permalink

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
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (Future[Unit]) ⇒ A): (MessageType) ⇒ A

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

    Permalink

    Same as Tranquilizer.send.

    message

    the message to send

    returns

    a future that resolves when the message is sent

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

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

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

    Permalink

    Stop the tranquilizer, and close the underlying Beam.

    Stop the tranquilizer, and close the underlying Beam.

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

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

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

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

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def flush(): Unit

    Permalink

    Block until all messages that have been passed to "send" before this call to "flush" have been processed and their futures have been resolved.

    Block until all messages that have been passed to "send" before this call to "flush" have been processed and their futures have been resolved.

    This method will not throw any exceptions, even if some messages failed to send. You need to check the returned futures for that.

  16. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def isAvailable: Boolean

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

    Permalink
    Definition Classes
    Any
  20. def log: Logger

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

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

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

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

    Permalink

    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

    Exceptions thrown

    BufferFullException if outgoing queue is full and blockOnFull is false.

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

    Permalink

    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

  27. def start(): Unit

    Permalink

    Start the tranquilizer.

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

    Annotations
    @LifecycleStart()
  28. def status: Status

    Permalink
    Definition Classes
    Service
  29. def stop(): Unit

    Permalink

    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()
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Logging

Inherited from Service[MessageType, Unit]

Inherited from Closable

Inherited from (MessageType) ⇒ Future[Unit]

Inherited from AnyRef

Inherited from Any

Ungrouped