Class StandardMessageProducer

java.lang.Object
com.adaptris.core.AdaptrisMessageWorkerImp
com.adaptris.core.AdaptrisMessageProducerImp
com.adaptris.core.ProduceOnlyProducerImp
interlok.rabbitmq.StandardMessageProducer
All Implemented Interfaces:
com.adaptris.core.AdaptrisComponent, com.adaptris.core.AdaptrisMessageProducer, com.adaptris.core.AdaptrisMessageSender, com.adaptris.core.AdaptrisMessageWorker, com.adaptris.core.ComponentLifecycle, com.adaptris.core.ComponentLifecycleExtension, com.adaptris.core.MessageEventGenerator

@ComponentProfile(summary="Publishes a message to RabbitMQ", tag="amqp, rabbitmq", recommended=RabbitMqConnection.class, since="4.3.0") public class StandardMessageProducer extends com.adaptris.core.ProduceOnlyProducerImp
Publishes a message to RabbitMQ.

RabbitMQ requires you to programatically declare both the exchange and queue before use. If you are not targetting the default exchange or have specific requirements about the queue declaration then please remember to configure a Declaration.ExchangeDeclaration and Declaration.QueueDeclaration respectively. By default we simply use the default exchange and the queue is declared to be durable, non-exclusive, with no auto-delete and no additional arguments.

Use a property-builder to configure how the BasicProperties object is created. Unless explicitly configured there will be no additional properties in the call to Channel#basicPublish.

  • Constructor Details

    • StandardMessageProducer

      public StandardMessageProducer()
  • Method Details

    • prepare

      public void prepare() throws com.adaptris.core.CoreException
      Throws:
      com.adaptris.core.CoreException
    • start

      public void start() throws com.adaptris.core.CoreException
      Throws:
      com.adaptris.core.CoreException
    • stop

      public void stop()
    • doProduce

      protected void doProduce(com.adaptris.core.AdaptrisMessage msg, String endpoint) throws com.adaptris.core.ProduceException
      Specified by:
      doProduce in class com.adaptris.core.ProduceOnlyProducerImp
      Throws:
      com.adaptris.core.ProduceException
    • withPropertyBuilder

    • endpoint

      public String endpoint(com.adaptris.core.AdaptrisMessage msg) throws com.adaptris.core.ProduceException
      Specified by:
      endpoint in class com.adaptris.core.AdaptrisMessageProducerImp
      Throws:
      com.adaptris.core.ProduceException
    • withQueue

      public StandardMessageProducer withQueue(String s)
    • getQueue

      public String getQueue()
      The queue to publish to.
    • setQueue

      public void setQueue(String queue)
      The queue to publish to.
    • getPropertyBuilder

      public Translator.BasicPropertiesBuilder getPropertyBuilder()
      How to build the required BasicProperties if required.

      The default if not explicitly specified is to return a null object which uses the default behaviour of RabbitMQ

    • setPropertyBuilder

      public void setPropertyBuilder(Translator.BasicPropertiesBuilder propertyBuilder)
      How to build the required BasicProperties if required.

      The default if not explicitly specified is to return a null object which uses the default behaviour of RabbitMQ

    • getExchangeDeclaration

      public Declaration.ExchangeDeclaration getExchangeDeclaration()
      How the Exchange will be declared prior to use.
    • setExchangeDeclaration

      public void setExchangeDeclaration(Declaration.ExchangeDeclaration exchangeDeclaration)
      How the Exchange will be declared prior to use.
    • getQueueDeclaration

      public Declaration.QueueDeclaration getQueueDeclaration()
      How the Queue will be declared prior to use.
    • setQueueDeclaration

      public void setQueueDeclaration(Declaration.QueueDeclaration queueDeclaration)
      How the Queue will be declared prior to use.