BatchOptions is used to create
EventDataBatches.
If you're creating
EventDataBatches with
EventHubClient, then you can set a partitionKey and maxMessageSize
using the .with() method. Alternatively, if you'd like the default settings, simply construct BatchOptions with the void constructor.
Default settings:
- partitionKey is null
- maxMessageSize is the maximum allowed size
If you're creating
EventDataBatches with
PartitionSender, then you can only set a maxMessageSize
using the .with() method. Alternatively, if you'd like the default settings, simply construct BatchOptions with the void constructor.
Default settings:
- maxMessageSize is the maximum allowed size
- Note: if you set a partition key, an
IllegalArgumentException will be thrown.
To construct either type of batch, create a
BatchOptions object and pass it into the appropriate
createBatch method. If using
PartitionSender, then use (
PartitionSender#createBatch(BatchOptions).
If using
EventHubClient, then use
EventHubClient#createBatch(BatchOptions).
// Note: For all examples, 'client' is an instance of EventHubClient. The usage is the same for PartitionSender,;
EventDataBatch edb3 = client.createBatch(options);
}