Interface AdaptrisMessageWorker
-
- All Superinterfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
- All Known Subinterfaces:
AdaptrisMessageConsumer,AdaptrisMessageProducer
- All Known Implementing Classes:
AdaptrisMessageConsumerImp,AdaptrisMessageProducerImp,AdaptrisMessageWorkerImp,AdaptrisPollingConsumer,BaseJmsPollingConsumerImpl,BasicJettyConsumer,DefinedJmsProducer,FsConsumer,FsConsumerImpl,FsProducer,FtpConsumer,FtpConsumerImpl,FtpProducer,FtpRecursiveConsumer,HttpProducer,JdbcStoredProcedureProducer,JettyMessageConsumer,JmsAsyncProducer,JmsConsumer,JmsConsumerImpl,JmsPollingConsumer,JmsPollingConsumerImpl,JmsProducer,JmsProducerImpl,JmsSyncConsumer,JmxNotificationConsumer,LargeFsConsumer,LargeFsProducer,MovingNonDeletingFsConsumer,NonDeletingFsConsumer,NullMessageConsumer,NullMessageProducer,PasConsumer,PasPollingConsumer,PasProducer,PollingTrigger,ProduceOnlyProducerImp,PtpConsumer,PtpPollingConsumer,PtpProducer,RelaxedFtpConsumer,RelaxedFtpProducer,RequestReplyProducerBase,RequestReplyProducerImp,ResponseProducerImpl,StandaloneConsumer,StandardHttpProducer,StandardResponseProducer,TraversingFsConsumer
public interface AdaptrisMessageWorker extends AdaptrisComponent, MessageEventGenerator
Defines behaviour common to
AdaptrisMessageConsumerandAdaptrisMessageProducer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AdaptrisMessagedecode(byte[] bytes)Decodes the passed byte[] using the configuredAdaptrisMessageEncoder.byte[]encode(AdaptrisMessage msg)Encode the passed message using the configuredAdaptrisMessageEncoder.AdaptrisMessageEncodergetEncoder()Returns theAdaptrisMessageEncoderto use.AdaptrisMessageFactorygetMessageFactory()voidhandleConnectionException()Called if a connection exception is encountered.voidregisterConnection(AdaptrisConnection connection)Sets theAdaptrisConnectionthis component will use.<T> TretrieveConnection(java.lang.Class<T> type)Return this components underlying connection.voidsetEncoder(AdaptrisMessageEncoder encoder)Sets theAdaptrisMessageEncoderto use.voidsetMessageFactory(AdaptrisMessageFactory f)Set the message factory used when creating AdaptrisMessage instances.-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stop
-
Methods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
registerConnection
void registerConnection(AdaptrisConnection connection)
Sets the
AdaptrisConnectionthis component will use.- Parameters:
connection- theAdaptrisConnectionto use
-
retrieveConnection
<T> T retrieveConnection(java.lang.Class<T> type)
Return this components underlying connection.- Parameters:
type- the type of connection to cast to.- Returns:
- the connection
-
getEncoder
AdaptrisMessageEncoder getEncoder()
Returns the
AdaptrisMessageEncoderto use.- Returns:
- the
AdaptrisMessageEncoderto use
-
setEncoder
void setEncoder(AdaptrisMessageEncoder encoder)
Sets the
AdaptrisMessageEncoderto use.- Parameters:
encoder- theAdaptrisMessageEncoderto use
-
handleConnectionException
void handleConnectionException() throws CoreExceptionCalled if a connection exception is encountered. Generally this will be when a polling consumer fails to obtain input, when a producer fails to produce or when some third party thread such as JMS exception listener is invoked.
- Throws:
CoreException- wrapping underlying Exceptions
-
encode
byte[] encode(AdaptrisMessage msg) throws CoreException
Encode the passed message using the configured
AdaptrisMessageEncoder. If no AME is configured implementations should returnmsg.getBytes().- Parameters:
msg- theAdaptrisMessageto encode- Returns:
- the
AdaptrisMessageencoded as a byte[] - Throws:
CoreException- wrapping any that occur
-
decode
AdaptrisMessage decode(byte[] bytes) throws CoreException
Decodes the passed byte[] using the configured
AdaptrisMessageEncoder. If no AME is configured, implementations should just set the byte[] as the payload of a new message.- Parameters:
bytes- the byte[] to decode- Returns:
- an
AdaptrisMessage - Throws:
CoreException- wrapping any that occur
-
getMessageFactory
AdaptrisMessageFactory getMessageFactory()
- Returns:
- the messageFactory
-
setMessageFactory
void setMessageFactory(AdaptrisMessageFactory f)
Set the message factory used when creating AdaptrisMessage instances.- Parameters:
f- the messageFactory to set
-
-