The Talon Manual

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

In This Section

Serialization and Deserialization

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 Metatadata

 

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.

MessageViewTypeshortThe id of the type (unique to its factory) used to deserialize the message.
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.

MessageMetadata Class

SMA provides a helper class, com.neeve.MessageMetadata, that can be used by applications to assist in working with message metadata. This helper class provides the ability to serialize data into a binary format and also serves a view around this metadata.

The serialized form is as follows where (encoding is little endian). 

OffsetDescription
02 (version)
1
Message encoding type
2-3
Message view factory
4-5
Message view type
6-9
Message sender
10-13
Message flow
14-21
Message sequence number
22-23
Message channel id
24-25
number of characters in channel name
26...
ascii encoded characters in channel name


Sending Messages from External Applications

When integrating with legacy application that do not use the platform's message abstraction layer it is useful to understand how to populate transport level message in a manner that a Talon application can receive and deserialize them. 

Solace

The platform's Solace binding transports encoded messages in a BytesMessage. The encoded messages is set as the message data, and the metadata is stored as serialized MessageMetadata in the "x-sma-metadata" property. The example below shows how an external application can send a message natively using the solace JCSMP client:

JMS

The platform's JMS binding encodes a serialized message payload in a bytes message and sets metadata fields in its jms headers. The following example show 

 

Receiving Message in External Applications

Solace

The following code sample shows how an external application using the Solace JCSMP api directly can unpack a message sent over the platform's built in JMS binding and materialize it into a message view. 

JMS

The following code sample shows how an external  application using the JMS api directly can unpack a message sent over the platform's built in JMS binding and materialize it into a message view. 

  • No labels