Package interlok.rabbitmq
Class PublishToDefaultExchange
java.lang.Object
com.adaptris.core.ServiceImp
interlok.rabbitmq.PublishToDefaultExchange
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConnectedService,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Put the message payload onto an AMQP Queue",
recommended=RabbitMqConnection.class,
since="4.3.0",
tag="amqp,rabbitmq")
public class PublishToDefaultExchange
extends ServiceImp
implements ConnectedService
Wraps
StandardMessageProducer as a service for discoverability purposes.
This is the simplest way to publish a message to RabbitMQ to an exchange of "" which is equivalent to the default exchange.
It does not expose all the configuration possible to StandardMessageProducer and is included as a convenience to simply publish a
message to a RabbitMQ Queue. It does expose a RabbitMqConnection as configuration so you will have the opportunity to share
connections.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumControls behaviour when publishing the messsage. -
Field Summary
Fields inherited from class com.adaptris.core.ServiceImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidvoiddoService(AdaptrisMessage msg) What to do after publishing the message depending on whether that was successful or not.The RabbitMQ Connection.How to build the requiredBasicPropertiesif required.getQueue()The queue to publish to.final voidfinal voidprepare()voidsetBehaviour(PublishToDefaultExchange.Behaviour behaviour) What to do after publishing the message depending on whether that was successful or not.voidsetConnection(AdaptrisConnection connection) The RabbitMQ Connection.voidsetPropertyBuilder(Translator.BasicPropertiesBuilder propertyBuilder) How to build the requiredBasicPropertiesif required.voidThe queue to publish to.voidstart()voidstop()Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueIdMethods inherited from interface com.adaptris.core.ComponentLifecycle
close, initMethods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpointMethods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueIdMethods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
Constructor Details
-
PublishToDefaultExchange
public PublishToDefaultExchange()
-
-
Method Details
-
doService
- Specified by:
doServicein interfaceService- Throws:
ServiceException
-
prepare
- Specified by:
preparein interfaceComponentLifecycleExtension- Throws:
CoreException
-
initService
- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
public final void closeService()- Specified by:
closeServicein classServiceImp
-
start
- Specified by:
startin interfaceComponentLifecycle- Overrides:
startin classServiceImp- Throws:
CoreException
-
stop
public void stop()- Specified by:
stopin interfaceComponentLifecycle- Overrides:
stopin classServiceImp
-
withConnection
-
withQueue
-
getQueue
The queue to publish to. -
setQueue
The queue to publish to. -
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
How to build the requiredBasicPropertiesif required.The default if not explicitly specified is to return a
nullobject which uses the default behaviour of RabbitMQ. -
getBehaviour
What to do after publishing the message depending on whether that was successful or not.- TRADITIONAL : act like a traditional service and throw an exception if publishing was not successful
- NO_EXCEPTION: Never throw an exception, add metadata against the key "queue_publish_status" indicating success or failure. Failure will contain the stacktrace from the exception but no exception will be thrown by the service.
-
setBehaviour
What to do after publishing the message depending on whether that was successful or not.- TRADITIONAL : act like a traditional service and throw an exception if publishing was not successful
- NO_EXCEPTION: Never throw an exception, add metadata against the key "queue_publish_status" indicating success or failure. Failure will contain the stacktrace from the exception but no exception will be thrown by the service.
-
getConnection
The RabbitMQ Connection.- Specified by:
getConnectionin interfaceConnectedService
-
setConnection
The RabbitMQ Connection.- Specified by:
setConnectionin interfaceConnectedService
-