Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The FIX Antenna HFT library supports sending messages in batches, which allows for efficient transmission by grouping multiple messages into a single memory chunk. These batched messages are stored as a contiguous vector in memory and passed to the OS socket API in one send operation. This guide will teach you how to use the Engine::PutMessageOptions::BatchOp enumeration to control batching operations when working with the Session::push method.

...

Summary of BatchOp Options and Behavior

BatchOp Value

Description

Behavior

Error Condition

NotBatched

Sends a single non-batched message immediately.

Sends the message without batching.

Throws std::runtime_error if a batch is in progress.

Begin

Starts a new batch and pre-allocates memory for it.

Initializes a new batch for message grouping.

Throws std::runtime_error if a batch is already in progress.

Add

Adds a message to the current batch. Starts a new batch if none exists.

Appends the message to the batch. Reallocates memory buffer if needed.

No error condition for starting.

Send

Finalizes the current batch and sends all accumulated messages.

Sends the batch buffer through the OS socket API. Ends the current batch.

Throws std::runtime_error if no batch is active.

By using these options effectively, you can manage message batching with precision, improve performance, and handle messages according to the specific requirements of your application.