C# Class KafkaNet.Protocol.Message

Message represents the data from a single event occurance.
Datei anzeigen Open project: gigya/KafkaNetClient Class Usage Examples

Public Methods

Method Description
DecodeMessage ( long offset, byte payload ) : IEnumerable

Decode messages from a payload and assign it a given kafka offset.

The return type is an Enumerable as the message could be a compressed message set.

DecodeMessageSet ( byte messageSet ) : IEnumerable

Decode a byte[] that represents a collection of messages.

EncodeMessage ( Message message ) : byte[]

Encodes a message object to byte[]

Format: Crc (Int32), MagicByte (Byte), Attribute (Byte), Key (Byte[]), Value (Byte[])

EncodeMessageSet ( IEnumerable messages ) : byte[]

Encodes a collection of messages into one byte[]. Encoded in order of list.

Message ( ) : KafkaNet.Common

Construct an empty message.

Message ( string value, string key = null ) : KafkaNet.Common

Convenience constructor will encode both the key and message to byte streams. Most of the time a message will be string based.

Method Details

DecodeMessage() public static method

Decode messages from a payload and assign it a given kafka offset.
The return type is an Enumerable as the message could be a compressed message set.
public static DecodeMessage ( long offset, byte payload ) : IEnumerable
offset long The offset represting the log entry from kafka of this message.
payload byte The byte[] encode as a message from kafka.
return IEnumerable

DecodeMessageSet() public static method

Decode a byte[] that represents a collection of messages.
public static DecodeMessageSet ( byte messageSet ) : IEnumerable
messageSet byte The byte[] encode as a message set from kafka.
return IEnumerable

EncodeMessage() public static method

Encodes a message object to byte[]
Format: Crc (Int32), MagicByte (Byte), Attribute (Byte), Key (Byte[]), Value (Byte[])
public static EncodeMessage ( Message message ) : byte[]
message Message Message data to encode.
return byte[]

EncodeMessageSet() public static method

Encodes a collection of messages into one byte[]. Encoded in order of list.
public static EncodeMessageSet ( IEnumerable messages ) : byte[]
messages IEnumerable The collection of messages to encode together.
return byte[]

Message() public method

Construct an empty message.
public Message ( ) : KafkaNet.Common
return KafkaNet.Common

Message() public method

Convenience constructor will encode both the key and message to byte streams. Most of the time a message will be string based.
public Message ( string value, string key = null ) : KafkaNet.Common
value string The main content data of this message.
key string The key value for the message. Can be null.
return KafkaNet.Common