Class

eu.shiftforward.adstax.util

AmqpClient

Related Doc: package util

Permalink

class AmqpClient extends AnyRef

An AMQP client simplifying some of the common interactions with AMQP brokers. It handles correctly cases in which the broker is not reachable at the time operations are done, waiting for a connection to be established first.

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

Instance Constructors

  1. new AmqpClient(amqpConfig: RabbitMQ, queueNamespace: String = "")(implicit actorRefFactory: ActorRefFactory)

    Permalink

    amqpConfig

    the AMQP broker config

    queueNamespace

    a namespace which all queues created without a name will have

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 addConsumer(actor: ActorRef, exchangeName: String, routingKey: String, queueName: Option[String] = None, autodelete: Boolean = true, handlerActor: Option[ActorRef] = None, clientFacing: Boolean = false): Future[String]

    Permalink

    Declares a queue, binds it to an exchange and routing key and adds a consumer to it.

    Declares a queue, binds it to an exchange and routing key and adds a consumer to it.

    actor

    the actor which will consume com.github.sstone.amqp.Amqp.Delivery messages

    exchangeName

    the exchange name

    routingKey

    the routing key

    queueName

    the underlying queue name wrapped in a Some, or None to generate one with a random suffix

    autodelete

    true if the queue should be destroyed when it is no longer used, false otherwise

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    clientFacing

    true if the queue will be read by an AdStax-external client, false otherwise

    returns

    a Future that is completed with the queue name when the consumer is successfully added.

  5. def addConsumerWithBindingActor(actor: ActorRef, exchangeName: String, routingKey: String, queueName: Option[String] = None, autodelete: Boolean = true, handlerActor: Option[ActorRef] = None, clientFacing: Boolean = false): Future[(ActorRef, String)]

    Permalink

    Declares a queue, binds it to an exchange and routing key and adds a consumer to it.

    Declares a queue, binds it to an exchange and routing key and adds a consumer to it. Returns additionally the underlying actor doing the binding, which can be killed later to stop the consumption of AMQP messages.

    actor

    the actor which will consume com.github.sstone.amqp.Amqp.Delivery messages

    exchangeName

    the exchange name

    routingKey

    the routing key

    queueName

    the underlying queue name wrapped in a Some, or None to generate one with a random suffix

    autodelete

    true if the queue should be destroyed when it is no longer used, false otherwise

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    clientFacing

    true if the queue will be read by an AdStax-external client, false otherwise

    returns

    a Future that is completed with the underlying binding actor and the queue name when the consumer is successfully added.

  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. lazy val connectionOwner: ActorRef

    Permalink
  9. def createProducer(handlerActor: Option[ActorRef]): ActorRef

    Permalink

    Creates a producer actor.

    Creates a producer actor. Producer actors can be sent com.github.sstone.amqp.Amqp.Publish, which they dispatch to the AMQP broker. The created actor will discard publish messages that are sent at a time in which the client is disconnected from the broker.

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    returns

    the ActorRef of the producer.

  10. def createRpcClient(handlerActor: Option[ActorRef] = None): Future[ActorRef]

    Permalink

    Creates an RPC client.

    Creates an RPC client.

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    returns

    a Future that is completed with the RPC producer actor when it is successfully bound.

  11. def createRpcServer(exchangeName: String, routingKey: String, queueName: Option[String] = None, handlerActor: Option[ActorRef] = None, timeout: Option[FiniteDuration] = None)(process: (Delivery) ⇒ Future[ProcessResult]): Future[String]

    Permalink

    Sets up an RPC server.

    Sets up an RPC server. The server starts processing incoming messages sent to an exchange and routing key and replies to them according to a given behavior.

    The queue name can be None to create a One-To-Many (all servers/processors handle the request) or specified for a One-To-Any (only one server/processor will handle the request).

    exchangeName

    the exchange name

    routingKey

    the routing key

    queueName

    the underlying queue name wrapped in a Some for One-To-Any behavior, or None to generate one with a random suffix for One-To-Many behavior

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    timeout

    an optional message timeout to avoid filling up the queue with old, already ignored, responses

    process

    the function that processes Delivery messages and returns the reply for each one of them

    returns

    a Future that is completed with the queue name when the server is started.

  12. def createStashedProducer(): ActorRef

    Permalink

    Creates a producer actor which stashes messages until the producer is fully connected to the AMQP broker.

    Creates a producer actor which stashes messages until the producer is fully connected to the AMQP broker. Producer actors can be sent com.github.sstone.amqp.Amqp.Publish, which they dispatch to the AMQP broker.

    returns

    the ActorRef of the producer.

  13. def declareExchange(exchangeName: String, exchangeType: String = "topic", handlerActor: Option[ActorRef] = None): Future[Unit]

    Permalink

    Declares an exchange.

    Declares an exchange.

    exchangeName

    the exchange name

    exchangeType

    the exchange type

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    returns

    a Future that is completed when the exchange is successfully declared.

  14. def declareQueue(exchangeName: String, routingKey: String, queueName: Option[String] = None, handlerActor: Option[ActorRef] = None, clientFacing: Boolean = false): Future[String]

    Permalink

    Declares a queue and binds it to an exchange and routing key.

    Declares a queue and binds it to an exchange and routing key.

    exchangeName

    the exchange name to bind the queue to

    routingKey

    the routing key to bind the queue to

    queueName

    the queue name wrapped in a Some, or None to generate one with a random suffix

    handlerActor

    the actor to handle the channel state; it can receive the messages com.github.sstone.amqp.ChannelOwner.Disconnected, com.github.sstone.amqp.ChannelOwner.Connected and com.github.sstone.amqp.Amqp.Error

    clientFacing

    true if the queue will be read by an AdStax-external client, false otherwise

    returns

    a Future that is completed with the queue name when the queue is successfully bound.

  15. implicit def dispatcher: ExecutionContextExecutor

    Permalink

    The ExecutionContext used by this client to schedule asynchronous tasks.

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

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

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

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

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

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

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped