CreateBatchOptions Class

  • java.lang.Object
    • com.azure.messaging.eventhubs.models.CreateBatchOptions

public class CreateBatchOptions

The set of options that can be specified when creating an EventDataBatch.

Constructor Summary

Constructor Description
CreateBatchOptions()

Creates a new instance.

Method Summary

Modifier and Type Method and Description
int getMaximumSizeInBytes()

Gets the maximum size to allow for the batch of events, in bytes.

String getPartitionId()

Gets the identifier of the Event Hub partition that the events in the EventDataBatch will be sent to.

String getPartitionKey()

Gets the partition routing key on an event batch.

CreateBatchOptions setMaximumSizeInBytes(int maximumSizeInBytes)

Sets the maximum size for the EventDataBatch, in bytes.

CreateBatchOptions setPartitionId(String partitionId)

Sets the identifier of the Event Hub partition that the events in the EventDataBatch will be sent to.

CreateBatchOptions setPartitionKey(String partitionKey)

Sets a hashing key to be provided for the batch of events.

Methods inherited from java.lang.Object

Constructor Details

CreateBatchOptions

public CreateBatchOptions()

Creates a new instance.

Method Details

getMaximumSizeInBytes

public int getMaximumSizeInBytes()

Gets the maximum size to allow for the batch of events, in bytes.

Returns:

The maximum size to allow for a single batch of events, in bytes.

getPartitionId

public String getPartitionId()

Gets the identifier of the Event Hub partition that the events in the EventDataBatch will be sent to. If the identifier is not specified, the Event Hubs service will be responsible for routing events that are sent to an available partition.

Returns:

The identifier of the Event Hub partition that the EventDataBatch will be set to. null or an empty string if Event Hubs service is responsible for routing events.

getPartitionKey

public String getPartitionKey()

Gets the partition routing key on an event batch. If specified, tells the Event Hubs service that these events belong to the same group and should belong to the same partition.

Returns:

The partition hashing key to associate with the event or batch of events.

setMaximumSizeInBytes

public CreateBatchOptions setMaximumSizeInBytes(int maximumSizeInBytes)

Sets the maximum size for the EventDataBatch, in bytes.

Parameters:

maximumSizeInBytes - The maximum size to allow for the EventDataBatch.

Returns:

The updated CreateBatchOptions object.

setPartitionId

public CreateBatchOptions setPartitionId(String partitionId)

Sets the identifier of the Event Hub partition that the events in the EventDataBatch will be sent to. If the identifier is not specified, the Event Hubs service will be responsible for routing events that are sent to an available partition.

Parameters:

partitionId - The identifier of the Event Hub partition that the EventDataBatch events will be sent to. null or an empty string if Event Hubs service is responsible for routing events.

Returns:

The updated CreateBatchOptions object.

setPartitionKey

public CreateBatchOptions setPartitionKey(String partitionKey)

Sets a hashing key to be provided for the batch of events. Events with the same partitionKey are hashed and sent to the same partition.

Parameters:

partitionKey - The partition hashing key to associate with the event or batch of events.

Returns:

The updated CreateBatchOptions object.

Applies to