|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MessageTranscoder
A MessageTranscoder
is used to encode or decode message metadata. Custom transcoders can be used to
read and write metadata for messages that were produced by or will be consumed by clients that do not use DropboxMQ.
One common use of MessageTranscoder
is to override the default message filename when sending messages
to non-DropboxMQ client. Such a client may expect message filenames to have a very specific format.
Method Summary | |
---|---|
Message |
decodeMetadata(SessionImpl session,
File messageFile,
String originalFilename,
boolean priorityAndSelectorOnly,
String messageSelector)
Decodes the provided metadata and creates a new emtpy message. |
String |
encodeMetadata(Message message)
Encodes the metadata of a given message. |
Method Detail |
---|
String encodeMetadata(Message message) throws JMSException
message
- the message that is being sent
JMSException
- if the transcoder fails to encode the metadata contained in the message. Such an exception
or any RuntimeException will cause the message to not be sent.Message decodeMetadata(SessionImpl session, File messageFile, String originalFilename, boolean priorityAndSelectorOnly, String messageSelector) throws IOException
session
- a session that should be used to create a new message that will contain the metadata after it
has been decodedmessageFile
- the message file containing metadata to be decodedoriginalFilename
- the original name of the file as it was produced. The name returned by
messageFile.getName() has been modified from the original. If a transcoder needs to decode metadata from the
message filename, this parameter should be used.priorityAndSelectorOnly
- decodeMetadata() is called twice, first for determining priority and applying
any message selectors, and second as a message is consumed; careful transcoders can apply some optimizations to
the first call when this value will be set to truemessageSelector
- the message selector to be applied to the message. May be used to further optimize the
decoding process. If priorityAndSelectorOnly is true and messageSelector is null, transcoders can safely decode
the JMS priority and JMS timestamp only. If priorityAndSelectorOnly is true, messageSelector does not contain
a specific selection and the decoding of metadata to support the specific selection is costly, transcoders can
safely skip the decoding of the specific selection. For instance perhaps decoding the JMS type (@see
javax.jms.Message#getJMSType()) requires parsing the message body. A transcoder may scan the message for
JMSType and if priorityAndSelectorOnly is true and messageSelector does not contain JMSType, the transcoder can
safely choose to not parse the message body.
IOException
- if the transcoder encounters any problems reading the message file, the exception should be
passed up to the caller
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |