C# Class Kafka.Client.Message

Message for Kafka.
A message. The format of an N byte message is the following: 1 byte "magic" identifier to allow format changes 4 byte CRC32 of the payload N - 5 byte payload
ファイルを表示 Open project: precog/kafka Class Usage Examples

Public Methods

Method Description
GetBytes ( ) : byte[]

Converts the message to bytes in the format Kafka likes.

IsValid ( ) : bool

Determines if the message is valid given the payload and its checksum.

Message ( byte payload ) : System

Initializes a new instance of the Message class.

Uses the DefaultMagicIdentifier as a default.

Message ( byte payload, byte magic ) : System

Initializes a new instance of the Message class.

Initializes the checksum as null. It will be automatically computed.

Message ( byte payload, byte magic, byte checksum ) : System

Initializes a new instance of the Message class.

ParseFrom ( byte data ) : Message

Parses a message from a byte array given the format Kafka likes.

ToString ( ) : string

Try to show the payload as decoded to UTF-8.

Private Methods

Method Description
CalculateChecksum ( ) : byte[]

Calculates the CRC32 checksum on the payload of the message.

Method Details

GetBytes() public method

Converts the message to bytes in the format Kafka likes.
public GetBytes ( ) : byte[]
return byte[]

IsValid() public method

Determines if the message is valid given the payload and its checksum.
public IsValid ( ) : bool
return bool

Message() public method

Initializes a new instance of the Message class.
Uses the DefaultMagicIdentifier as a default.
public Message ( byte payload ) : System
payload byte The data for the payload.
return System

Message() public method

Initializes a new instance of the Message class.
Initializes the checksum as null. It will be automatically computed.
public Message ( byte payload, byte magic ) : System
payload byte The data for the payload.
magic byte The magic identifier.
return System

Message() public method

Initializes a new instance of the Message class.
public Message ( byte payload, byte magic, byte checksum ) : System
payload byte The data for the payload.
magic byte The magic identifier.
checksum byte The checksum for the payload.
return System

ParseFrom() public static method

Parses a message from a byte array given the format Kafka likes.
public static ParseFrom ( byte data ) : Message
data byte The data for a message.
return Message

ToString() public method

Try to show the payload as decoded to UTF-8.
public ToString ( ) : string
return string