SendOptions Class
- java.
lang. Object - com.
azure. messaging. eventhubs. models. SendOptions
- com.
public class SendOptions
The set of options that can be specified when sending a set of events to influence the way in which events are sent to the Event Hubs service.
Constructor Summary
| Constructor | Description |
|---|---|
| SendOptions() |
Creates a new instance. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| String |
getPartitionId()
Gets the identifier of the Event Hub partition that the EventData will be sent to. |
| String |
getPartitionKey()
Gets the hashing key on an event batch. |
|
Send |
setPartitionId(String partitionId)
Sets the identifier of the Event Hub partition that the EventData will be sent to. |
|
Send |
setPartitionKey(String partitionKey)
Sets a hashing key to be provided for the batch of events, which instructs the Event Hubs service to map this key to a specific partition. |
Methods inherited from java.lang.Object
Constructor Details
SendOptions
public SendOptions()
Creates a new instance.
Method Details
getPartitionId
public String getPartitionId()
Gets the identifier of the Event Hub partition that the EventData 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:
null
or an empty string if Event Hubs service is responsible for routing events.getPartitionKey
public String getPartitionKey()
Gets the hashing 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:
setPartitionId
public SendOptions setPartitionId(String partitionId)
Sets the identifier of the Event Hub partition that the EventData 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:
null or an empty string if Event Hubs service is responsible for routing events.
Returns:
setPartitionKey
public SendOptions setPartitionKey(String partitionKey)
Sets a hashing key to be provided for the batch of events, which instructs the Event Hubs service to map this key to a specific partition.
The selection of a partition is stable for a given partition hashing key. Should any other batches of events be sent using the same exact partition hashing key, the Event Hubs service will route them all to the same partition.
This should be specified only when there is a need to group events by partition, but there is flexibility into which partition they are routed. If ensuring that a batch of events is sent only to a specific partition, it is recommended that the setPartitionId(String partitionId) when sending the batch.
Parameters:
Returns: