Class StandaloneProducer
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.StandaloneProducer
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisMessageSender,ComponentLifecycle,ComponentLifecycleExtension,ConnectedService,MessageEventGenerator,Service,StateManagedComponent
- Direct Known Subclasses:
RetryOnceStandaloneProducer,StandaloneRequestor
@ComponentProfile(summary="Produce a message where as part of a service chain", tag="service") public class StandaloneProducer extends ServiceImp implements AdaptrisMessageSender, ConnectedServiceWrapper for a
AdaptrisConnectionand aAdaptrisMessageProducerfor convenience. Also implementsServicefor use inServiceCollections.- See Also:
AdaptrisMessageSender
In the adapter configuration file this class is aliased as standalone-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description StandaloneProducer()Creates a new instance.StandaloneProducer(AdaptrisConnection c, AdaptrisMessageProducer p)StandaloneProducer(AdaptrisMessageProducer p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()java.lang.StringcreateName()Create a name for anyMleMarkerthat is generated.java.lang.StringcreateQualifier()Create a qualifier for anyMleMarkerthat is generated.voiddoService(AdaptrisMessage msg)Apply the service to the message.AdaptrisConnectiongetConnection()Returns the connection to use.AdaptrisMessageProducergetProducer()Returns the producer to use.protected voidinitService()voidprepare()Prepare for initialisation.voidproduce(AdaptrisMessage msg)Produces theAdaptrisMessageto the default destination.voidsetConnection(AdaptrisConnection conn)Sets the connection to use, may not be null.voidsetProducer(AdaptrisMessageProducer prod)Sets the producer to use, may not be null.voidstart()Starts the component.voidstop()Stop the component-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
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.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Constructor Detail
-
StandaloneProducer
public StandaloneProducer()
Creates a new instance. Defaults to null connection / producer.
-
StandaloneProducer
public StandaloneProducer(AdaptrisMessageProducer p)
-
StandaloneProducer
public StandaloneProducer(AdaptrisConnection c, AdaptrisMessageProducer p)
-
-
Method Detail
-
produce
public void produce(AdaptrisMessage msg) throws ProduceException
Description copied from interface:AdaptrisMessageSenderProduces theAdaptrisMessageto the default destination.- Specified by:
producein interfaceAdaptrisMessageSender- Parameters:
msg- the @link AdaptrisMessage} to produce- Throws:
ProduceException- wrapping any underlying Exceptions
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
start
public void start() throws CoreExceptionDescription copied from interface:ComponentLifecycleStarts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer, calling start will begin message delivery.- Specified by:
startin interfaceComponentLifecycle- Overrides:
startin classServiceImp- Throws:
CoreException- wrapping any underlyingExceptions- See Also:
ComponentLifecycle.start()
-
stop
public void stop()
Description copied from interface:ComponentLifecycleStop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing aRuntimeExceptionmay cause unintended consequences- Specified by:
stopin interfaceComponentLifecycle- Overrides:
stopin classServiceImp- See Also:
ComponentLifecycle.stop()
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Specified by:
preparein interfaceComponentLifecycleExtension- Throws:
CoreException
-
getConnection
public AdaptrisConnection getConnection()
Returns the connection to use.
- Specified by:
getConnectionin interfaceConnectedService- Returns:
- the connection to use
-
getProducer
public AdaptrisMessageProducer getProducer()
Returns the producer to use.
- Returns:
- the producer to use
-
setConnection
public void setConnection(AdaptrisConnection conn)
Sets the connection to use, may not be null.
- Specified by:
setConnectionin interfaceConnectedService- Parameters:
conn- the connection to use, may not be null
-
setProducer
public void setProducer(AdaptrisMessageProducer prod)
Sets the producer to use, may not be null.
- Parameters:
prod- the producer to use, may not be null
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Specified by:
doServicein interfaceService- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions- See Also:
#doService(com.adaptris.core.AdaptrisMessage)
-
createName
public java.lang.String createName()
Description copied from interface:MessageEventGeneratorCreate a name for anyMleMarkerthat is generated.The default implementation is to return the classname of the component in question.
* @return the name for anyMleMarkerthat is generated.- Specified by:
createNamein interfaceMessageEventGenerator- Overrides:
createNamein classServiceImp
-
createQualifier
public java.lang.String createQualifier()
Description copied from interface:MessageEventGeneratorCreate a qualifier for anyMleMarkerthat is generated.The default implementation is to return the unique-id of the component in question, or the empty string if not configured
- Specified by:
createQualifierin interfaceMessageEventGenerator- Overrides:
createQualifierin classServiceImp- Returns:
- the qualifier for any
MleMarkerthat is generated.
-
-