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
AdaptrisMessageConsumer
andAdaptrisMessageProducer
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AdaptrisMessage
decode(byte[] bytes)
Decodes the passed byte[] using the configuredAdaptrisMessageEncoder
.byte[]
encode(AdaptrisMessage msg)
Encode the passed message using the configuredAdaptrisMessageEncoder
.AdaptrisMessageEncoder
getEncoder()
Returns theAdaptrisMessageEncoder
to use.AdaptrisMessageFactory
getMessageFactory()
void
handleConnectionException()
Called if a connection exception is encountered.void
registerConnection(AdaptrisConnection connection)
Sets theAdaptrisConnection
this component will use.<T> T
retrieveConnection(java.lang.Class<T> type)
Return this components underlying connection.void
setEncoder(AdaptrisMessageEncoder encoder)
Sets theAdaptrisMessageEncoder
to use.void
setMessageFactory(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
AdaptrisConnection
this component will use.- Parameters:
connection
- theAdaptrisConnection
to 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
AdaptrisMessageEncoder
to use.- Returns:
- the
AdaptrisMessageEncoder
to use
-
setEncoder
void setEncoder(AdaptrisMessageEncoder encoder)
Sets the
AdaptrisMessageEncoder
to use.- Parameters:
encoder
- theAdaptrisMessageEncoder
to use
-
handleConnectionException
void handleConnectionException() throws CoreException
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
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
- theAdaptrisMessage
to encode- Returns:
- the
AdaptrisMessage
encoded 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
-
-