Class AdaptrisMessageWorkerImp
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
- Direct Known Subclasses:
AdaptrisMessageConsumerImp
,AdaptrisMessageProducerImp
Implementation of behaviour common to AdaptrisMessageConsumer
and AdaptrisMessageProducer
.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a name for anyMleMarker
that is generated.Create a qualifier for anyMleMarker
that is generated.decode
(byte[] bytes) Decodes the passed byte[] using the configuredAdaptrisMessageEncoder
.byte[]
encode
(AdaptrisMessage msg) Encode the passed message using the configuredAdaptrisMessageEncoder
.Returns theAdaptrisMessageEncoder
to use.Get the unique-id that is associated with this component.void
Called if a connection exception is encountered.boolean
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.void
Sets theAdaptrisConnection
this component will use.protected void
<T> T
retrieveConnection
(Class<T> type) Return this components underlying connection.void
Sets theAdaptrisMessageEncoder
to use.void
void
Set the message factory used when creating AdaptrisMessage instances.void
<T extends AdaptrisMessageWorkerImp>
T<T extends AdaptrisMessageWorkerImp>
TwithUniqueID
(String uid) 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.ComponentLifecycle
close, init, start, stop
Methods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
Field Details
-
log
protected transient org.slf4j.Logger log
-
-
Constructor Details
-
AdaptrisMessageWorkerImp
public AdaptrisMessageWorkerImp()
-
-
Method Details
-
handleConnectionException
Description copied from interface:AdaptrisMessageWorker
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.
- Specified by:
handleConnectionException
in interfaceAdaptrisMessageWorker
- Throws:
CoreException
- wrapping underlying Exceptions- See Also:
-
createName
Description copied from interface:MessageEventGenerator
Create a name for anyMleMarker
that is generated.The default implementation is to return the classname of the component in question.
* @return the name for anyMleMarker
that is generated.- Specified by:
createName
in interfaceMessageEventGenerator
-
createQualifier
Description copied from interface:MessageEventGenerator
Create a qualifier for anyMleMarker
that 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:
createQualifier
in interfaceMessageEventGenerator
- Returns:
- the qualifier for any
MleMarker
that is generated.
-
encode
Description copied from interface:AdaptrisMessageWorker
Encode the passed message using the configured
AdaptrisMessageEncoder
. If no AME is configured implementations should returnmsg.getBytes()
.- Specified by:
encode
in interfaceAdaptrisMessageWorker
- Parameters:
msg
- theAdaptrisMessage
to encode- Returns:
- the
AdaptrisMessage
encoded as a byte[] - Throws:
CoreException
- wrapping any that occur
-
decode
Description copied from interface:AdaptrisMessageWorker
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.- Specified by:
decode
in interfaceAdaptrisMessageWorker
- Parameters:
bytes
- the byte[] to decode- Returns:
- an
AdaptrisMessage
- Throws:
CoreException
- wrapping any that occur
-
getEncoder
Description copied from interface:AdaptrisMessageWorker
Returns the
AdaptrisMessageEncoder
to use.- Specified by:
getEncoder
in interfaceAdaptrisMessageWorker
- Returns:
- the
AdaptrisMessageEncoder
to use
-
setEncoder
Description copied from interface:AdaptrisMessageWorker
Sets the
AdaptrisMessageEncoder
to use.- Specified by:
setEncoder
in interfaceAdaptrisMessageWorker
- Parameters:
enc
- theAdaptrisMessageEncoder
to use
-
retrieveConnection
Description copied from interface:AdaptrisMessageWorker
Return this components underlying connection.- Specified by:
retrieveConnection
in interfaceAdaptrisMessageWorker
- Parameters:
type
- the type of connection to cast to.- Returns:
- the connection
-
registerConnection
Description copied from interface:AdaptrisMessageWorker
Sets the
AdaptrisConnection
this component will use.- Specified by:
registerConnection
in interfaceAdaptrisMessageWorker
- Parameters:
conn
- theAdaptrisConnection
to use
-
getUniqueId
Description copied from interface:AdaptrisComponent
Get the unique-id that is associated with this component.- Specified by:
getUniqueId
in interfaceAdaptrisComponent
- Returns:
- the unique-id
-
setUniqueId
-
getIsTrackingEndpoint
-
isTrackingEndpoint
public boolean isTrackingEndpoint()Description copied from interface:MessageEventGenerator
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.
- Specified by:
isTrackingEndpoint
in interfaceMessageEventGenerator
- Returns:
- true if this should be considered an 'end-point' for tracking purposes, otherwise false
-
setIsTrackingEndpoint
-
getMessageFactory
- Specified by:
getMessageFactory
in interfaceAdaptrisMessageWorker
- Returns:
- the messageFactory
-
setMessageFactory
Description copied from interface:AdaptrisMessageWorker
Set the message factory used when creating AdaptrisMessage instances.- Specified by:
setMessageFactory
in interfaceAdaptrisMessageWorker
- Parameters:
f
- the messageFactory to set
-
withMessageFactory
-
withUniqueID
-
registerEncoderMessageFactory
protected void registerEncoderMessageFactory()
-