Interface AdaptrisMessageWorker
- All Superinterfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
- All Known Subinterfaces:
AdaptrisMessageConsumer,AdaptrisMessageProducer
- All Known Implementing Classes:
AdaptrisMessageConsumerImp,AdaptrisMessageProducerImp,AdaptrisMessageWorkerImp,AdaptrisPollingConsumer,BaseJmsPollingConsumerImpl,BasicJettyConsumer,ChannelUnavailableConnectionErrorHandlingProducer,ConnectionErrorHandlingProducer,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
Defines behaviour common to AdaptrisMessageConsumer and
AdaptrisMessageProducer.
-
Method Summary
Modifier and TypeMethodDescriptiondecode(byte[] bytes) Decodes the passed byte[] using the configuredAdaptrisMessageEncoder.byte[]encode(AdaptrisMessage msg) Encode the passed message using the configuredAdaptrisMessageEncoder.Returns theAdaptrisMessageEncoderto use.voidCalled if a connection exception is encountered.voidregisterConnection(AdaptrisConnection connection) Sets theAdaptrisConnectionthis component will use.<T> TretrieveConnection(Class<T> type) Return this components underlying connection.voidsetEncoder(AdaptrisMessageEncoder encoder) Sets theAdaptrisMessageEncoderto use.voidSet the message factory used when creating AdaptrisMessage instances.Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueIdMethods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stopMethods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepareMethods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Method Details
-
registerConnection
Sets the
AdaptrisConnectionthis component will use.- Parameters:
connection- theAdaptrisConnectionto use
-
retrieveConnection
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
Sets the
AdaptrisMessageEncoderto use.- Parameters:
encoder- theAdaptrisMessageEncoderto use
-
handleConnectionException
Called 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
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
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
Set the message factory used when creating AdaptrisMessage instances.- Parameters:
f- the messageFactory to set
-