public final class MessageMetadata extends UtlListElement implements UtlPool.Item<MessageMetadata>
This class serves as helper class for provider implementations that do not possess native capabilities to transport message metadata elements (sender, flow, sno, ...) natively. The class provides facilities to serialize and deserialize metadata elements to/from a flat wire format for use by the provider implementations to transport the metadata elements across the wire.
Modifier and Type | Field and Description |
---|---|
static int |
FIXED_WIRE_LENGTH |
static int |
FIXED_WIRE_LENGTH_V1 |
static int |
FIXED_WIRE_LENGTH_V2 |
static byte |
V1 |
static byte |
V2 |
static byte |
VERSION |
count, head, next, prev
Modifier and Type | Method and Description |
---|---|
MessageMetadata |
acquire()
Acquires the
MessageMetadata preventing it from being
returned to the underlying pool. |
int |
deserialize(ByteBuffer serializedMetadata)
Deserialize contents from a byte buffer
|
void |
dispose()
Dispose off this
MessageMetadata |
PktBuffer |
getBuffer()
Get the backing buffer
The metadata object manipulates its field in place in its backing
buffer returned by this method.
|
static short |
getLatestVersion()
Get the latest metadata version.
|
short |
getMessageChannelId()
Get the message channel id (V1 metadata Field).
|
static short |
getMessageChannelId(ByteBuffer buffer)
Get the message channel id (V1 metadata Field) from a serialized buffer.
|
static short |
getMessageChannelId(ByteBuffer buffer,
int offset)
Get the message channel id (V1 metadata Field) from a serialized buffer.
|
String |
getMessageChannelName()
Get the message channel name (V1 metadata Field).
|
static String |
getMessageChannelName(ByteBuffer buffer)
Get the message channel name (V1 metadata Field) from a serialized buffer.
|
static String |
getMessageChannelName(ByteBuffer buffer,
int offset)
Get the message channel name (V1 metadata Field) from a serialized buffer.
|
XString |
getMessageChannelNameAsRaw()
Get the message channel name (V1 metadata Field).
|
static void |
getMessageChannelNameToRaw(ByteBuffer buffer,
int offset,
XString target)
Get the message channel name (V1 metadata Field) from a serialized buffer.
|
static void |
getMessageChannelNameToRaw(ByteBuffer buffer,
XString target)
Get the message channel name (V1 metadata Field) from a serialized buffer.
|
byte |
getMessageEncodingType()
Get the message encoding type (V1 metadata Field).
|
static byte |
getMessageEncodingType(ByteBuffer buffer)
Get the message encoding type (V1 metadata Field) from a serialized buffer.
|
static byte |
getMessageEncodingType(ByteBuffer buffer,
int offset)
Get the message encoding type (V1 metadata Field) from a serialized buffer.
|
int |
getMessageFlow()
Get the message flow (V1 metadata Field).
|
static int |
getMessageFlow(ByteBuffer buffer)
Get the message flow (V1 metadata Field) from a serialized buffer.
|
static int |
getMessageFlow(ByteBuffer buffer,
int offset)
Get the message flow (V1 metadata Field) from a serialized buffer.
|
int |
getMessageSender()
Get the message sender (V1 metadata Field).
|
static int |
getMessageSender(ByteBuffer buffer)
Get the message sender (V1 metadata Field) from a serialized buffer
|
static int |
getMessageSender(ByteBuffer buffer,
int offset)
Get the message sender (V1 metadata Field) from a serialized buffer
|
long |
getMessageSno()
Get the message sequence number (V1 metadata Field).
|
static long |
getMessageSno(ByteBuffer buffer)
Get the message sequence number (V1 metadata Field) from a serialized buffer.
|
static long |
getMessageSno(ByteBuffer buffer,
int offset)
Get the message sequence number (V1 metadata Field) from a serialized buffer.
|
short |
getMessageViewFactory()
Get the message view factory (V1 metadata Field).
|
static short |
getMessageViewFactory(ByteBuffer buffer)
Get the message view factory (V1 metadata Field) from a serialized buffer.
|
static short |
getMessageViewFactory(ByteBuffer buffer,
int offset)
Get the message view factory (V1 metadata Field) from a serialized buffer.
|
short |
getMessageViewType()
Get the message view (V2 metadata Field).
|
static short |
getMessageViewType(ByteBuffer buffer)
Get the message view (V2 metadata Field) from a serialized buffer.
|
static short |
getMessageViewType(ByteBuffer buffer,
int offset)
Get the message view (V2 metadata Field) from a serialized buffer.
|
UtlPool<MessageMetadata> |
getPool()
Implementation of UtlPool.Item#getPool
|
int |
getSerializedLength()
Get the serialized length of the message metadata elements.
|
static int |
getSerializedLength(short version,
ByteBuffer buffer)
Get the serialized length of the message metadata wire format for a given wire format version.
|
static int |
getSerializedLength(short version,
ByteBuffer buffer,
int offset)
Get the serialized length of the message metadata wire format for a given wire format version.
|
short |
getVersion()
Get the metadata version (V1 metadata Field).
|
MessageMetadata |
init()
Implementation of UtlPool.Item#init
|
void |
serializeV1(byte encodingType,
short vfid,
int sender,
int flow,
long sno,
short channelId,
XString channelName)
Serialize version 1 metadata content
|
static int |
serializeV1(byte encodingType,
short vfid,
int sender,
int flow,
long sno,
short channelId,
XString channelName,
PktBuffer buffer)
Serialize version 1 metadata content
|
void |
serializeV2(byte encodingType,
short vfid,
short vid,
int sender,
int flow,
long sno,
short channelId,
XString channelName)
Serialize version 2 metadata content
|
static int |
serializeV2(byte encodingType,
short vfid,
short vid,
int sender,
int flow,
long sno,
short channelId,
XString channelName,
ByteBuffer buffer,
int offset)
Serialize version 2 metadata content
|
static int |
serializeV2(byte encodingType,
short vfid,
short vid,
int sender,
int flow,
long sno,
short channelId,
XString channelName,
PktBuffer buffer)
Serialize version 2 metadata content
|
MessageMetadata |
setPool(UtlPool<MessageMetadata> pool)
Implementation of UtlPool.Item#setPool
|
String |
toString()
Return a string representation of the object.
|
int |
wrap(com.neeve.io.IOBuffer serializedMetadata)
Wrap a metadata object around an IO buffer.
|
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
public static final int FIXED_WIRE_LENGTH_V1
public static final int FIXED_WIRE_LENGTH_V2
public static final int FIXED_WIRE_LENGTH
public static final byte V1
public static final byte V2
public static final byte VERSION
public static final short getLatestVersion()
public static final int getSerializedLength(short version, ByteBuffer buffer, int offset)
public static final int getSerializedLength(short version, ByteBuffer buffer)
public final short getVersion()
public static final byte getMessageEncodingType(ByteBuffer buffer, int offset)
public static final byte getMessageEncodingType(ByteBuffer buffer)
public final byte getMessageEncodingType()
public static final short getMessageViewFactory(ByteBuffer buffer, int offset)
public static final short getMessageViewFactory(ByteBuffer buffer)
public final short getMessageViewFactory()
public static final short getMessageViewType(ByteBuffer buffer, int offset)
public static final short getMessageViewType(ByteBuffer buffer)
public final short getMessageViewType()
public static final int getMessageSender(ByteBuffer buffer, int offset)
public static final int getMessageSender(ByteBuffer buffer)
public final int getMessageSender()
public static final int getMessageFlow(ByteBuffer buffer, int offset)
public static final int getMessageFlow(ByteBuffer buffer)
public final int getMessageFlow()
public static final long getMessageSno(ByteBuffer buffer, int offset)
public static final long getMessageSno(ByteBuffer buffer)
public final long getMessageSno()
public static final short getMessageChannelId(ByteBuffer buffer, int offset)
public static final short getMessageChannelId(ByteBuffer buffer)
public final short getMessageChannelId()
public static final String getMessageChannelName(ByteBuffer buffer, int offset)
public static final String getMessageChannelName(ByteBuffer buffer)
public static final void getMessageChannelNameToRaw(ByteBuffer buffer, int offset, XString target)
public static final void getMessageChannelNameToRaw(ByteBuffer buffer, XString target)
public final XString getMessageChannelNameAsRaw()
public final String getMessageChannelName()
public final PktBuffer getBuffer()
The metadata object manipulates its field in place in its backing buffer returned by this method. The caller can call this method to get the buffer with the latest copy of its contents at any time during the lifecycle of the metadata object.
public static final int serializeV1(byte encodingType, short vfid, int sender, int flow, long sno, short channelId, XString channelName, PktBuffer buffer)
public final void serializeV1(byte encodingType, short vfid, int sender, int flow, long sno, short channelId, XString channelName)
public static final int serializeV2(byte encodingType, short vfid, short vid, int sender, int flow, long sno, short channelId, XString channelName, ByteBuffer buffer, int offset)
public static final int serializeV2(byte encodingType, short vfid, short vid, int sender, int flow, long sno, short channelId, XString channelName, PktBuffer buffer)
public final void serializeV2(byte encodingType, short vfid, short vid, int sender, int flow, long sno, short channelId, XString channelName)
public final int wrap(com.neeve.io.IOBuffer serializedMetadata) throws SmaException
serializedMetadata
- Contains the serialized form of the metadata
This method wraps a message metadata object around a supplied IO buffer. The method assumes that the serialized form of the metadata starts at the beginning of the IO buffer and the number of valid bytes in the buffer is equal to the length of the IO buffer.
SmaException
public final int deserialize(ByteBuffer serializedMetadata) throws SmaException
SmaException
public final int getSerializedLength()
This method returns the serialized length of the message metadata elements. This length is governed by the metadata wire format version. /P>
public final MessageMetadata acquire()
MessageMetadata
preventing it from being
returned to the underlying pool.MessageMetadata
for invocation chaining.public final void dispose()
MessageMetadata
public final MessageMetadata init()
init
in interface UtlPool.Item<MessageMetadata>
public final MessageMetadata setPool(UtlPool<MessageMetadata> pool)
setPool
in interface UtlPool.Item<MessageMetadata>
public final UtlPool<MessageMetadata> getPool()
getPool
in interface UtlPool.Item<MessageMetadata>
UtlPool.Item.setPool(com.neeve.util.UtlPool<T>)
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.