Class StandardMessageProducer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageProducerImp
-
- com.adaptris.core.ProduceOnlyProducerImp
-
- interlok.rabbitmq.StandardMessageProducer
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisMessageProducer,AdaptrisMessageSender,AdaptrisMessageWorker,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
@ComponentProfile(summary="Publishes a message to RabbitMQ", tag="amqp, rabbitmq", recommended=RabbitMqConnection.class, since="4.3.0") public class StandardMessageProducer extends ProduceOnlyProducerImpPublishes 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.ExchangeDeclarationandDeclaration.QueueDeclarationrespectively. 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
BasicPropertiesobject is created. Unless explicitly configured there will be no additional properties in the call toChannel#basicPublish.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description StandardMessageProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoProduce(AdaptrisMessage msg, java.lang.String endpoint)java.lang.Stringendpoint(AdaptrisMessage msg)Declaration.ExchangeDeclarationgetExchangeDeclaration()How the Exchange will be declared prior to use.Translator.BasicPropertiesBuildergetPropertyBuilder()How to build the requiredBasicPropertiesif required.java.lang.StringgetQueue()The queue to publish to.Declaration.QueueDeclarationgetQueueDeclaration()How the Queue will be declared prior to use.voidprepare()voidsetExchangeDeclaration(Declaration.ExchangeDeclaration exchangeDeclaration)How the Exchange will be declared prior to use.voidsetPropertyBuilder(Translator.BasicPropertiesBuilder propertyBuilder)How to build the requiredBasicPropertiesif required.voidsetQueue(java.lang.String queue)The queue to publish to.voidsetQueueDeclaration(Declaration.QueueDeclaration queueDeclaration)How the Queue will be declared prior to use.voidstart()voidstop()StandardMessageProducerwithPropertyBuilder(Translator.BasicPropertiesBuilder b)StandardMessageProducerwithQueue(java.lang.String s)-
Methods inherited from class com.adaptris.core.ProduceOnlyProducerImp
produce, request, request
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
prepare
public void prepare() throws CoreException- Throws:
CoreException
-
start
public void start() throws CoreException- Throws:
CoreException
-
stop
public void stop()
-
doProduce
protected void doProduce(AdaptrisMessage msg, java.lang.String endpoint) throws ProduceException
- Specified by:
doProducein classProduceOnlyProducerImp- Throws:
ProduceException
-
withPropertyBuilder
public StandardMessageProducer withPropertyBuilder(Translator.BasicPropertiesBuilder b)
-
endpoint
public java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
- Specified by:
endpointin classAdaptrisMessageProducerImp- Throws:
ProduceException
-
withQueue
public StandardMessageProducer withQueue(java.lang.String s)
-
getQueue
public java.lang.String getQueue()
The queue to publish to.
-
setQueue
public void setQueue(java.lang.String queue)
The queue to publish to.
-
getPropertyBuilder
public Translator.BasicPropertiesBuilder getPropertyBuilder()
How to build the requiredBasicPropertiesif required.The default if not explicitly specified is to return a
nullobject which uses the default behaviour of RabbitMQ
-
setPropertyBuilder
public void setPropertyBuilder(Translator.BasicPropertiesBuilder propertyBuilder)
How to build the requiredBasicPropertiesif required.The default if not explicitly specified is to return a
nullobject 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.
-
-