Class SendOptions

java.lang.Object
com.azure.messaging.eventhubs.models.SendOptions

public class SendOptions extends Object
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 Details

    • SendOptions

      public SendOptions()
  • Method Details

    • 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 identifier of the position be specified directly when sending the batch.

      Parameters:
      partitionKey - The partition hashing key to associate with the event or batch of events.
      Returns:
      The updated SendOptions object.
    • 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:
      The partition hashing key to associate with the event or batch of events.
    • getPartitionId

      public String getPartitionId()
      Gets the identifier of the Event Hub partition that the events 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 events will be set to. null or an empty string if Event Hubs service is responsible for routing events.
    • setPartitionId

      public SendOptions setPartitionId(String partitionId)
      Sets the identifier of the Event Hub partition that the events 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 events will be set to. null or an empty string if Event Hubs service is responsible for routing events.
      Returns:
      The updated SendOptions object.