public interface AdaptrisMessageWorker extends AdaptrisComponent, MessageEventGenerator
Defines behaviour common to AdaptrisMessageConsumer and
AdaptrisMessageProducer.
CONFIRMATION_ID_KEY| Modifier and Type | Method and Description |
|---|---|
AdaptrisMessage |
decode(byte[] bytes)
Decodes the passed byte[] using the configured
AdaptrisMessageEncoder. |
byte[] |
encode(AdaptrisMessage msg)
Encode the passed message using the configured
AdaptrisMessageEncoder. |
AdaptrisMessageEncoder |
getEncoder()
Returns the
AdaptrisMessageEncoder to use. |
AdaptrisMessageFactory |
getMessageFactory() |
void |
handleConnectionException()
Called if a connection exception is encountered.
|
void |
registerConnection(AdaptrisConnection connection)
Sets the
AdaptrisConnection this component will use. |
<T> T |
retrieveConnection(java.lang.Class<T> type)
Return this components underlying connection.
|
void |
setEncoder(AdaptrisMessageEncoder encoder)
Sets the
AdaptrisMessageEncoder to use. |
void |
setMessageFactory(AdaptrisMessageFactory f)
Set the message factory used when creating AdaptrisMessage instances.
|
getUniqueIdclose, init, start, stoppreparecreateName, createQualifier, isTrackingEndpointvoid registerConnection(AdaptrisConnection connection)
Sets the AdaptrisConnection this component will use.
connection - the AdaptrisConnection to use<T> T retrieveConnection(java.lang.Class<T> type)
type - the type of connection to cast to.AdaptrisMessageEncoder getEncoder()
Returns the AdaptrisMessageEncoder to use.
AdaptrisMessageEncoder to usevoid setEncoder(AdaptrisMessageEncoder encoder)
Sets the AdaptrisMessageEncoder to use.
encoder - the AdaptrisMessageEncoder to usevoid 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.
CoreException - wrapping underlying Exceptionsbyte[] encode(AdaptrisMessage msg) throws CoreException
Encode the passed message using the configured
AdaptrisMessageEncoder. If no AME is configured
implementations should return msg.getBytes().
msg - the AdaptrisMessage to encodeAdaptrisMessage encoded as a byte[]CoreException - wrapping any that occurAdaptrisMessage 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.
bytes - the byte[] to decodeAdaptrisMessageCoreException - wrapping any that occurAdaptrisMessageFactory getMessageFactory()
void setMessageFactory(AdaptrisMessageFactory f)
f - the messageFactory to set