Package

com.spingo

op_rabbit

Permalink

package op_rabbit

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. op_rabbit
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class AirbrakeLogger extends RabbitErrorLogging

    Permalink

    To use this package, you must add 'op-rabbit-airbrake' to your dependencies.

    BATTERIES NOT INCLUDED

    To use this package, you must add 'op-rabbit-airbrake' to your dependencies.

    Overview

    Instantiates a new RabbitErrorLogging strategy that reports exceptions, along with message and message headers, to Airbrake.

    Instantiating from config

    Call the convenience lazy-getter AirBrake.fromConfig to get a AirbrakeLogger initialize from application configuration, which should be formatted as follows:

    airbrake {
      app-name = "my-awesome-app"
      key = "deadbeefdeadbeefdeadbeefdeadbeef"
      environment = "production"
    }
  2. trait Binding extends QueueDefinition[Abstract] with ExchangeDefinition[Abstract]

    Permalink
  3. case class ConnectionParams(hosts: Seq[Address] = ..., username: String = ConnectionFactory.DEFAULT_USER, password: String = ConnectionFactory.DEFAULT_PASS, virtualHost: String = ConnectionFactory.DEFAULT_VHOST, ssl: Boolean = false, clientProperties: Map[String, AnyRef] = Map.empty[String, Object], connectionTimeout: Int = 10000, exceptionHandler: ExceptionHandler = new DefaultExceptionHandler(), requestedChannelMax: Int = ..., requestedFrameMax: Int = ConnectionFactory.DEFAULT_FRAME_MAX, requestedHeartbeat: Int = ConnectionFactory.DEFAULT_HEARTBEAT, saslConfig: SaslConfig = DefaultSaslConfig.PLAIN, sharedExecutor: Option[ExecutorService] = None, shutdownTimeout: Int = ..., socketFactory: SocketFactory = SocketFactory.getDefault()) extends Product with Serializable

    Permalink

    Because topology recovery strategy configuration is crucial to how op-rabbit works, we don't allow some options to be specified

    Because topology recovery strategy configuration is crucial to how op-rabbit works, we don't allow some options to be specified

    Modeling the allowed options via a case-class allows the compiler to tell the library user which options aren't allowed.

  4. case class Delivery(consumerTag: String, envelope: Envelope, properties: BasicProperties, body: Array[Byte]) extends Product with Serializable

    Permalink

    Represents a message delivery for usage in consumers / Handlers.

  5. type Deserialized[T] = Either[ExtractRejection, T]

    Permalink
  6. trait Deserializer[A, B] extends (A) ⇒ Deserialized[B]

    Permalink
  7. abstract class Directive[+L <: HList] extends AnyRef

    Permalink
  8. type Directive1[T] = Directive[::[T, HNil]]

    Permalink
  9. trait Directives extends AnyRef

    Permalink

    Directives power the declarative DSL of op-rabbit.

    Directives power the declarative DSL of op-rabbit.

    In order to define a consumer, you need a channel directive, a consumer directive, and one or more extractor directives. For example:

    channel(qos = 3) {
      consume(queue("my.queue.name")) {
        (body(as[MyPayloadType]) & optionalProperty(ReplyTo) & optionalProperty(Priority)) { (myPayload, replyTo, priority) =>
          // work ...
          ack
        }
      }
    }

    As seen, directives are composable via &. In the end, the directive is applied with a function whose parameters match the output values from the directive(s).

    One value of the directives, as opposed to accessing the AMQP properties directly, is that they are type safe, and care was taken to reduce the probability of surprise. Death is swiftly issued to null and Object. Some directives, such as property, will nack the message if the value specified can't be extracted; IE it is null. If you'd prefer to use a default value instead of nacking the message, you can specify alternative values using | provide(...).

    (property(ReplyTo) | provide("default-reply-to") { replyTo =>
      // ...
    }

    Note: the directives themselves don't actually do anything, except when applied / returned. IE:

    channel(qos = 3) {
      consume(queue("my.queue.name")) {
        property(ReplyTo) // does absolutely nothing
    
        body(as[MyPayloadType]) { (myPayload, replyTo, priority) =>
          ack // this ack here does absolutely nothing (not the return value)
          // work ...
          ack
        }
      }
    }
  10. trait Exchange[+T <: op_rabbit.Exchange.Value] extends ExchangeDefinition[Concrete]

    Permalink

    Common interface for how exchanges are defined.

    Common interface for how exchanges are defined.

    See:

  11. case class GenericMarshallingException(message: String) extends MarshallingException with Product with Serializable

    Permalink
  12. type Handler = (Promise[ReceiveResult], Delivery) ⇒ Unit

    Permalink
  13. case class InvalidFormat(received: String, error: String) extends MarshallingException with Product with Serializable

    Permalink

    This exception is thrown when a RabbitUnmarshaller tries to unmarshall a message with the wrong contentType specified in the header.

  14. sealed abstract class MarshallingException extends Exception

    Permalink
  15. final class Message extends MessageForPublicationLike

    Permalink

    Confirmed Message container.

    Confirmed Message container. Send to RabbitControl actor for delivery. Upon delivery confirmation, RabbitControl will respond to the sender with true.

    Use the factory method Message$.apply to instantiate one of these using an implicit RabbitMarshaller for serialization.

    See also

    Message$.exchange, Message$.topic, Message$.queue

  16. trait MessageForPublicationLike extends (Channel) ⇒ Unit

    Permalink

    Basic interface; send to RabbitControl actor for delivery.

  17. case class MismatchedContentType(received: String, expected: String) extends MarshallingException with Product with Serializable

    Permalink

    This exception is thrown when a RabbitUnmarshaller tries to unmarshall a message with the wrong contentType specified in the header.

  18. trait Publisher extends AnyRef

    Permalink
  19. class RabbitControl extends Actor with ActorLogging with Stash

    Permalink

    RabbitControl is the top-level actor which handles the following:

    Overview

    RabbitControl is the top-level actor which handles the following:

    - Pull configuration from the rabbitmq config block, and establish connection to RabbitMQ - Manage subscriptions

    Messages received

    RabbitControl accepts the following commands / queries:

  20. trait RabbitErrorLogging extends AnyRef

    Permalink

    Basic trait for reporting error messages; implement to build your own error reporting strategies to be used with consumers

  21. trait RabbitMarshaller[T] extends AnyRef

    Permalink

    This trait is used to serialize messages for publication; it configures a property builder and sets the appropriate headers

    This trait is used to serialize messages for publication; it configures a property builder and sets the appropriate headers

    See also

    RabbitUnmarshaller, UTF8StringMarshaller, BinaryMarshaller

  22. trait RabbitUnmarshaller[T] extends AnyRef

    Permalink

    This trait is used to deserialize messages from binary format for use in Consumers; it checks and honors the contentType / encoding message headers, as appropriate.

    This trait is used to deserialize messages from binary format for use in Consumers; it checks and honors the contentType / encoding message headers, as appropriate.

    See also

    RabbitMarshaller, UTF8StringMarshaller, BinaryMarshaller

  23. sealed trait ReceiveResult extends AnyRef

    Permalink
  24. trait RecoveryStrategy extends (String, Channel, Throwable) ⇒ Handler

    Permalink

    Instructs RabbitMQ what to do in the event of a consumer failure, failure being defined as the handler throwing an exception, the fail directive being used, or ack(Future.failed(ex)) / ack(Failure(ex)).

    Instructs RabbitMQ what to do in the event of a consumer failure, failure being defined as the handler throwing an exception, the fail directive being used, or ack(Future.failed(ex)) / ack(Failure(ex)).

    By contract, RecoveryStrategy accept a queueName, channel, and exception, and return a Handler whose status dictates the fate of the recovered message. A RecoveryStratregy should not do any asynchronous work involving the provided channel

  25. sealed trait Rejection extends Exception

    Permalink
  26. class StatusCheckMessage extends MessageForPublicationLike

    Permalink

    Send this message to RabbitControl to check the status of our connection to the RabbitMQ broker.

  27. class Subscription extends Directives

    Permalink

    A Subscription contains a full definition for a consumer (channel, binding, handling, error recovery, reportings, etc.) subscription

    A Subscription contains a full definition for a consumer (channel, binding, handling, error recovery, reportings, etc.) subscription

    This object is sent to RabbitControl to boot.

    Example instantiation:

    Subscription { import Directives._

    channel(qos = 1) { consume(queue("such-queue")) { body(as[String]) { payload => // do work... ack } } } }

  28. trait SubscriptionRef extends AnyRef

    Permalink
  29. class TopicMatcher extends AnyRef

    Permalink
  30. class TypeHolder[T] extends AnyRef

    Permalink
    Attributes
    protected
  31. final class UnconfirmedMessage extends MessageForPublicationLike

    Permalink

Value Members

  1. object AirbrakeLogger

    Permalink

  2. object BinaryMarshaller extends RabbitMarshaller[Array[Byte]] with RabbitUnmarshaller[Array[Byte]]

    Permalink

    Pull binary message payload raw, without any serialization.

    Pull binary message payload raw, without any serialization. An implicit is defined in RabbitUnmarshaller$.binaryUnmarshaller and RabbitMarshaller$.binaryUnmarshaller

  3. object Binding

    Permalink
  4. object CirceSupport

    Permalink
  5. object ConnectionParams extends Serializable

    Permalink
  6. object Deserializer extends DeserializerLowerPriorityImplicits

    Permalink
  7. object Directive

    Permalink
  8. object Directives extends Directives

    Permalink

    Convenience object and recommended way for bringing the directives in scope.

    Convenience object and recommended way for bringing the directives in scope. See Directives trait.

  9. object Exchange extends Enumeration

    Permalink
  10. object Json4sSupport

    Permalink

    To use this package, you must add 'op-rabbit-json4s' to your dependencies.

    BATTERIES NOT INCLUDED

    To use this package, you must add 'op-rabbit-json4s' to your dependencies.

    Using

    If using json4s-native, import Json4sSupport.native._

    If using json4s-jackson, import Json4sSupport.jackson._

  11. object Message extends MessageFactory[Message]

    Permalink

    Confirmed message generator.

    Confirmed message generator. See Message$

  12. object MessageForPublicationLike

    Permalink
  13. object ModeledConsumerArgs

    Permalink
  14. object ModeledMessageHeaders

    Permalink
  15. object PlayJsonSupport

    Permalink

    To use this package, you must add 'op-rabbit-play-json' to your dependencies.

    BATTERIES NOT INCLUDED

    To use this package, you must add 'op-rabbit-play-json' to your dependencies.

    Overview

    Use implicit PlayJson formats for serialization by importing this object.

    Example:

    import play.api.libs.json._
    import com.spingo.op_rabbit.PlayJsonSupport._
    
    object Example {
      case class Person(name: String, age: Int)
      implicit val format = Json.format[Person]
      // Both of these can be implicitly created:
      // - implicitly[RabbitMarshaller[Person]]
      // - implicitly[RabbitUnmarshaller[Person]]
      val consumer = AsyncAckingConsumer[Person]("PurplePeopleEater") { person =>
        Future { eat(person) }
      }
      val message = QueueMessage(Person("Bill", 25), "people-for-consumption")
    }
  16. object Publisher

    Permalink
  17. object Queue

    Permalink
  18. object RabbitConfig

    Permalink
  19. object RabbitControl

    Permalink
  20. object RabbitErrorLogging

    Permalink
  21. object RabbitExceptionMatchers

    Permalink
  22. object RabbitHelpers

    Permalink
  23. object RabbitMarshaller

    Permalink
  24. object RabbitUnmarshaller

    Permalink
  25. object ReceiveResult

    Permalink
  26. object RecoveryStrategy

    Permalink
  27. object Rejection extends Serializable

    Permalink
  28. object Slf4jLogger extends RabbitErrorLogging

    Permalink

    Reports consumer errors to Slf4j.

  29. object SprayJsonSupport

    Permalink

    To use this package, you must add 'op-rabbit-spray-json' to your dependencies.

    BATTERIES NOT INCLUDED

    To use this package, you must add 'op-rabbit-spray-json' to your dependencies.

    Overview

    Use implicit SprayJson formats for serialization by importing this object.

    Example:

    import spray.json.DefaultJsonProtocol
    import com.spingo.op_rabbit.SprayJsonSupport._
    
    object Example extends DefaultJsonProtocol {
      case class Person(name: String, age: Int)
      implicit val format = jsonFormat2(Person)
      // Both of these can be implicitly created:
      // - implicitly[RabbitMarshaller[Person]]
      // - implicitly[RabbitUnmarshaller[Person]]
      val consumer = AsyncAckingConsumer[Person]("PurplePeopleEater") { person =>
        Future { eat(person) }
      }
      val message = QueueMessage(Person("Bill", 25), "people-for-consumption")
    }
  30. object StatusCheckMessage

    Permalink
  31. object Subscription

    Permalink
  32. object SubscriptionActor

    Permalink
  33. object TopicMatcher

    Permalink
  34. object TypeHolder

    Permalink
    Attributes
    protected
  35. object UTF8StringMarshaller extends RabbitMarshaller[String] with RabbitUnmarshaller[String]

    Permalink

    Converts binary message to a UTF8 string, and back.

    Converts binary message to a UTF8 string, and back. An implicit is defined in RabbitUnmarshaller$.stringMarshaller and RabbitMarshaller$.stringMarshaller

  36. object UnconfirmedMessage extends MessageFactory[UnconfirmedMessage]

    Permalink
  37. val futureUnit: Future[Unit]

    Permalink
    Attributes
    protected
  38. package properties

    Permalink
  39. package stream

    Permalink

    To use this package, you must add 'op-rabbit-akka-stream' to your dependencies.

    Batteries not included

    To use this package, you must add 'op-rabbit-akka-stream' to your dependencies.

    Overview

    See also

    Akka Stream Specs on GitHub

Deprecated Value Members

  1. object LogbackLogger extends RabbitErrorLogging

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.2) LogbackLogger has been renamed to Slf4jLogger

Inherited from AnyRef

Inherited from Any

Ungrouped