The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Formatting changes and expanded context on the usage of message metadata.

...

Applications work with messages as normal java objects. These views must be serialized into a provider specific message when sent, and when received they must be deserialized (or wrapped). The Talon Application Data Modeler generates Factory objects that facilitate The application registers the generated factories that it uses with the Talon runtime to allow deserialization of messages as they are received from the messaging provider. 

 

Message Engine Independent Serializers

...

Code Block
java
java
@Generated(value="com.neeve.adm.AdmGenerator", date="Fri Jan 23 02:03:22 PST 2015")
public interface IMyMessage extends extends IRogNode, IRogMessage {

	public final byte [] serializeToByteArray();
	public final ByteBuffer serializeToByteBuffer();
	public final String serializeToJson();
 
	public final void deserializeFromByteArray(byte[] bytes);
	public final void deserializeFromByteBuffer(ByteBuffer bytes);
	public final void deserializeFromJson(String json)
}

 

 

 

Message Metatadata
Anchor
MESSAGE_METADATA
MESSAGE_METADATA

 

 

When a message is transported over a bus binding, metadata is attached to the message to assist in routing, encoding/decoding, and de-duplication. The mechanism of how this metadata is attached to a message is specific to each bus binding implementation. For cases where you are working with the messaging provider directly (not through a bus binding implementation it useful to understand the structure of message metadata and how it is serialized. 

FieldTypeDescription
Channel Identification
MessageChannelNameString

The name of the channel.

This is used by the receiver to lookup the channel on which the message should be dispatched to the application.

MessageChannelIdshort

The id of the channel.

This is used by the receiver to lookup the channel on which the message should be dispatched to the application. Using a channel id allows for more efficient lookup of the channel, but care must be taken that the specified channel id matches that configured for receivers of the message will be flagged as an unhandled message.

Message Encoding
Message encoding fields allows a receiving application to lookup a message factory and use it to deserialize or wrap a message.
MessageViewFactoryshort

The id of the factory that is used to deserialize the message.

This is used by the receiver to lookup the factory that is used to deserialize (or wrap) the received message payload.

The message view factory id can be determined by calling MessageView.getVfid()on a message. For ADM modeled messages, this will be the negative of the factory id defined in the model (user factory types are negative at runtime to distinguish between user and platform factory types).

MessageViewTypeshort

The id of the type (unique to its factory) used to deserialize the message.

The message view type can be determined by calling MessageView.getType() on a message. For ADM modeled messages, this will be the id of the message defined in the ADM model.

MessageEncodingTypebyte 

The encoding type of the message.

The encoding type is used by the factory to differentiate between possible encodings supported by the message, but may also be used by wire sniffers as a hint to decoding the message. Valid values are:

  • 3: Protobuf The encoded payload is a series of google protobuf bytes
  • 4: Xbuf The encoded payload is a series of google protobuf bytes which may use extensions employed by talon's protobuf implementat.
  • 5: Json The encoded payload is a utf-8 encoded string with json content.
  • 1: Custom The encoded payload is opaque bytes.
Message Sequencing
Message sequencing fields allow for the receiving application to filter duplicate and out of order messages. For a given sender id and flow, an AepEngine will filter out received messages that don't have a monotonically increasing sequence number
MessageSenderintA globally unique id that identifies the sender of a message.

By default an AepEngine uses the hashcode of the engine name as the sender id.  
MessageSnolong

A monotonically increasing sequence number.  

  • A sequence number of <=0 indicates that the message is not sequenced. Receivers should not perform duplicate checking on it.
  • A sequence number of 1 indicates that the start (or restart of a stream). A receiver that receives sequence numbers 1,2,3,1,2,3 should not consider the 4th message a duplicate.
  • Otherwise, receivers should consider a sequence number not greater than the previous sequence number as a duplicate.  
MessageFlowintIndicates the flow to which the message belongs. Flows allow for partitioning of message traffic in conjunction with application state and allow intra application state partitioning.

(warning) Usage of flows is not currently supported for end users. External senders should always set the flow to 0.

...