public class EventHubClient extends ClientEntity implements IEventHubClient
createFromConnectionString(String)| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONSUMER_GROUP_NAME |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
Instant dateTime,
long epoch)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
Instant dateTime,
long epoch,
ReceiverOptions receiverOptions)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
long epoch)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
long epoch,
ReceiverOptions receiverOptions)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
long epoch)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
CompletableFuture<PartitionReceiver> |
createEpochReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
long epoch,
ReceiverOptions receiverOptions)
Create a Epoch based EventHub receiver with given partition id and start receiving from the beginning of the partition stream.
|
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
Instant dateTime,
long epoch)
Synchronous version of
createEpochReceiver(String, String, Instant, long). |
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
Instant dateTime,
long epoch,
ReceiverOptions receiverOptions)
Synchronous version of
createEpochReceiver(String, String, Instant, long). |
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
long epoch)
Synchronous version of
createEpochReceiver(String, String, String, boolean, long). |
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
long epoch,
ReceiverOptions receiverOptions)
Synchronous version of
createEpochReceiver(String, String, String, boolean, long). |
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
long epoch)
Synchronous version of
createEpochReceiver(String, String, String, long). |
PartitionReceiver |
createEpochReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
long epoch,
ReceiverOptions receiverOptions)
Synchronous version of
createEpochReceiver(String, String, String, long). |
static CompletableFuture<EventHubClient> |
createFromConnectionString(String connectionString)
Factory method to create an instance of
EventHubClient using the supplied connectionString. |
static CompletableFuture<EventHubClient> |
createFromConnectionString(String connectionString,
RetryPolicy retryPolicy)
Factory method to create an instance of
EventHubClient using the supplied connectionString. |
static EventHubClient |
createFromConnectionStringSync(String connectionString)
Synchronous version of
createFromConnectionString(String). |
static EventHubClient |
createFromConnectionStringSync(String connectionString,
RetryPolicy retryPolicy)
Synchronous version of
createFromConnectionString(String). |
CompletableFuture<PartitionSender> |
createPartitionSender(String partitionId)
Create a
PartitionSender which can publish EventData's directly to a specific EventHub partition (sender type iii. |
PartitionSender |
createPartitionSenderSync(String partitionId)
Synchronous version of
createPartitionSender(String). |
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
Instant dateTime)
Create the EventHub receiver with given partition id and start receiving from the specified starting offset.
|
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
Instant dateTime,
ReceiverOptions receiverOptions)
Create the EventHub receiver with given partition id and start receiving from the specified starting offset.
|
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
String startingOffset)
The receiver is created for a specific EventHub partition from the specific consumer group.
|
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive)
Create the EventHub receiver with given partition id and start receiving from the specified starting offset.
|
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
ReceiverOptions receiverOptions)
Create the EventHub receiver with given partition id and start receiving from the specified starting offset.
|
CompletableFuture<PartitionReceiver> |
createReceiver(String consumerGroupName,
String partitionId,
String startingOffset,
ReceiverOptions receiverOptions)
The receiver is created for a specific EventHub partition from the specific consumer group.
|
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
Instant dateTime)
Synchronous version of
createReceiver(String, String, Instant). |
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
Instant dateTime,
ReceiverOptions receiverOptions)
Synchronous version of
createReceiver(String, String, Instant). |
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset)
Synchronous version of
createReceiver(String, String, String). |
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive)
Synchronous version of
createReceiver(String, String, String, boolean). |
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
boolean offsetInclusive,
ReceiverOptions receiverOptions)
Synchronous version of
createReceiver(String, String, String, boolean). |
PartitionReceiver |
createReceiverSync(String consumerGroupName,
String partitionId,
String startingOffset,
ReceiverOptions receiverOptions)
Synchronous version of
createReceiver(String, String, String). |
CompletableFuture<EventHubPartitionRuntimeInformation> |
getPartitionRuntimeInformation(String partitionId)
Retrieves dynamic information about a partition of an event hub (see
EventHubPartitionRuntimeInformation for
details. |
CompletableFuture<EventHubRuntimeInformation> |
getRuntimeInformation()
Retrieves general information about an event hub (see
EventHubRuntimeInformation for details). |
CompletableFuture<Void> |
onClose() |
CompletableFuture<Void> |
send(EventData data)
Send
EventData to EventHub. |
CompletableFuture<Void> |
send(EventData eventData,
String partitionKey)
Send an '
EventData with a partitionKey' to EventHub. |
CompletableFuture<Void> |
send(Iterable<EventData> eventDatas)
Send a batch of
EventData to EventHub. |
CompletableFuture<Void> |
send(Iterable<EventData> eventDatas,
String partitionKey)
Send a 'batch of
EventData with the same partitionKey' to EventHub. |
void |
sendSync(EventData data)
Synchronous version of
send(EventData). |
void |
sendSync(EventData eventData,
String partitionKey)
Synchronous version of
send(EventData, String). |
void |
sendSync(Iterable<EventData> eventDatas)
Synchronous version of
send(Iterable). |
void |
sendSync(Iterable<EventData> eventDatas,
String partitionKey)
Synchronous version of
send(Iterable, String). |
close, closeSync, getClientId, getLastKnownError, setClosed, throwIfClosedpublic static final String DEFAULT_CONSUMER_GROUP_NAME
public static EventHubClient createFromConnectionStringSync(String connectionString) throws ServiceBusException, IOException
createFromConnectionString(String).connectionString - The connection string to be used. See ConnectionStringBuilder to construct a connectionString.ServiceBusException - If Service Bus service encountered problems during connection creation.IOException - If the underlying Proton-J layer encounter network errors.public static EventHubClient createFromConnectionStringSync(String connectionString, RetryPolicy retryPolicy) throws ServiceBusException, IOException
createFromConnectionString(String).connectionString - The connection string to be used. See ConnectionStringBuilder to construct a connectionString.retryPolicy - A custom RetryPolicy to be used when communicating with EventHub.ServiceBusException - If Service Bus service encountered problems during connection creation.IOException - If the underlying Proton-J layer encounter network errors.public static CompletableFuture<EventHubClient> createFromConnectionString(String connectionString) throws ServiceBusException, IOException
EventHubClient using the supplied connectionString.
In a normal scenario (when re-direct is not enabled) - one EventHubClient instance maps to one Connection to the Azure ServiceBus EventHubs service.
The EventHubClient created from this method creates a Sender instance internally, which is used by the send(EventData) methods.
connectionString - The connection string to be used. See ConnectionStringBuilder to construct a connectionString.ServiceBusException - If Service Bus service encountered problems during connection creation.IOException - If the underlying Proton-J layer encounter network errors.public static CompletableFuture<EventHubClient> createFromConnectionString(String connectionString, RetryPolicy retryPolicy) throws ServiceBusException, IOException
EventHubClient using the supplied connectionString.
In a normal scenario (when re-direct is not enabled) - one EventHubClient instance maps to one Connection to the Azure ServiceBus EventHubs service.
The EventHubClient created from this method creates a Sender instance internally, which is used by the send(EventData) methods.
connectionString - The connection string to be used. See ConnectionStringBuilder to construct a connectionString.retryPolicy - A custom RetryPolicy to be used when communicating with EventHub.ServiceBusException - If Service Bus service encountered problems during connection creation.IOException - If the underlying Proton-J layer encounter network errors.public final void sendSync(EventData data) throws ServiceBusException
send(EventData).sendSync in interface IEventHubClientdata - the EventData to be sent.PayloadSizeExceededException - if the total size of the EventData exceeds a predefined limit set by the service. Default is 256k bytes.ServiceBusException - if Service Bus service encountered problems during the operation.UnresolvedAddressException - if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)public final CompletableFuture<Void> send(EventData data)
EventData to EventHub. The sent EventData will land on any arbitrarily chosen EventHubs partition.
There are 3 ways to send to EventHubs, each exposed as a method (along with its sendBatch overload):
send(EventData) or send(Iterable)
send(EventData, String) or send(Iterable, String)
PartitionSender.send(EventData) or PartitionSender.send(Iterable)
Use this method to Send, if:
a) the send(EventData) operation should be highly available and
b) the data needs to be evenly distributed among all partitions; exception being, when a subset of partitions are unavailable
send(EventData) send's the EventData to a Service Gateway, which in-turn will forward the EventData to one of the EventHubs' partitions. Here's the message forwarding algorithm:
i. Forward theEventData's to EventHub partitions, by equally distributing the data among all partitions (ex: Round-robin theEventData's to all EventHubs' partitions) ii. If one of the EventHub partitions is unavailable for a moment, the Service Gateway will automatically detect it and forward the message to another available partition - making the Send operation highly-available.
send in interface IEventHubClientdata - the EventData to be sent.send(EventData, String),
PartitionSender.send(EventData)public final void sendSync(Iterable<EventData> eventDatas) throws ServiceBusException
send(Iterable).sendSync in interface IEventHubClienteventDatas - batch of events to send to EventHubPayloadSizeExceededException - if the total size of the EventData exceeds a pre-defined limit set by the service. Default is 256k bytes.ServiceBusException - if Service Bus service encountered problems during the operation.UnresolvedAddressException - if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)public final CompletableFuture<Void> send(Iterable<EventData> eventDatas)
EventData to EventHub. The sent EventData will land on any arbitrarily chosen EventHubs partition.
This is the most recommended way to Send to EventHubs.
There are 3 ways to send to EventHubs, to understand this particular type of Send refer to the overload send(EventData), which is used to send single EventData.
Use this overload versus send(EventData), if you need to send a batch of EventData.
Sending a batch of EventData's is useful in the following cases:
i. Efficient send - sending a batch ofEventDatamaximizes the overall throughput by optimally using the number of sessions created to EventHubs' service. ii. Send multipleEventData's in a Transaction. To achieve ACID properties, the Gateway Service will forward allEventData's in the batch to a single EventHubs' partition.
Sample code (sample uses sync version of the api but concept are identical):
Gson gson = new GsonBuilder().create();
EventHubClient client = EventHubClient.createFromConnectionStringSync("__connection__");
while (true)
{
LinkedListEventData events = new LinkedListEventData();}
for (int count = 1; count 11; count++)
{
PayloadEvent payload = new PayloadEvent(count);
byte[] payloadBytes = gson.toJson(payload).getBytes(Charset.defaultCharset());
EventData sendEvent = new EventData(payloadBytes);
MapString, String applicationProperties = new HashMapString, String();
applicationProperties.put("from", "javaClient");
sendEvent.setProperties(applicationProperties);
events.add(sendEvent);
}
client.sendSync(events);
System.out.println(String.format("Sent Batch... Size: %s", events.size()));
}
for Exceptions refer to sendSync(Iterable)
send in interface IEventHubClienteventDatas - batch of events to send to EventHubsend(EventData, String),
PartitionSender.send(EventData)public final void sendSync(EventData eventData, String partitionKey) throws ServiceBusException
send(EventData, String).sendSync in interface IEventHubClienteventData - the EventData to be sent.partitionKey - the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at EventData.SystemProperties.getPartitionKey()PayloadSizeExceededException - if the total size of the EventData exceeds a pre-defined limit set by the service. Default is 256k bytes.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<Void> send(EventData eventData, String partitionKey)
EventData with a partitionKey' to EventHub. All EventData's with a partitionKey are guaranteed to land on the same partition.
This send pattern emphasize data correlation over general availability and latency.
There are 3 ways to send to EventHubs, each exposed as a method (along with its sendBatch overload):
i.send(EventData)orsend(Iterable)ii.send(EventData, String)orsend(Iterable, String)iii.PartitionSender.send(EventData)orPartitionSender.send(Iterable)
Use this type of Send, if:
i. There is a need for correlation of events based on Sender instance; The sender can generate a UniqueId and set it as partitionKey - which on the received Message can be used for correlation ii. The client wants to take control of distribution of data across partitions.
Multiple PartitionKey's could be mapped to one Partition. EventHubs service uses a proprietary Hash algorithm to map the PartitionKey to a PartitionId. Using this type of Send (Sending using a specific partitionKey), could sometimes result in partitions which are not evenly distributed.
send in interface IEventHubClienteventData - the EventData to be sent.partitionKey - the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at EventData.SystemProperties.getPartitionKey()send(EventData),
PartitionSender.send(EventData)public final void sendSync(Iterable<EventData> eventDatas, String partitionKey) throws ServiceBusException
send(Iterable, String).sendSync in interface IEventHubClienteventDatas - the batch of events to send to EventHubpartitionKey - the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at EventData.SystemProperties.getPartitionKey()PayloadSizeExceededException - if the total size of the EventData exceeds a pre-defined limit set by the service. Default is 256k bytes.ServiceBusException - if Service Bus service encountered problems during the operation.UnresolvedAddressException - if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)public final CompletableFuture<Void> send(Iterable<EventData> eventDatas, String partitionKey)
EventData with the same partitionKey' to EventHub. All EventData's with a partitionKey are guaranteed to land on the same partition.
Multiple PartitionKey's will be mapped to one Partition.
There are 3 ways to send to EventHubs, to understand this particular type of Send refer to the overload send(EventData, String), which is the same type of Send and is used to send single EventData.
Sending a batch of EventData's is useful in the following cases:
i. Efficient send - sending a batch of EventData maximizes the overall throughput by optimally using the number of sessions created to EventHubs service.
ii. Send multiple events in One Transaction. This is the reason why all events sent in a batch needs to have same partitionKey (so that they are sent to one partition only).
send in interface IEventHubClienteventDatas - the batch of events to send to EventHubpartitionKey - the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at EventData.SystemProperties.getPartitionKey()send(EventData),
PartitionSender.send(EventData)public final PartitionSender createPartitionSenderSync(String partitionId) throws ServiceBusException, IllegalArgumentException
createPartitionSender(String).createPartitionSenderSync in interface IEventHubClientpartitionId - partitionId of EventHub to send the EventData's toServiceBusException - if Service Bus service encountered problems during connection creation.IllegalArgumentExceptionpublic final CompletableFuture<PartitionSender> createPartitionSender(String partitionId) throws ServiceBusException
PartitionSender which can publish EventData's directly to a specific EventHub partition (sender type iii. in the below list).
There are 3 patterns/ways to send to EventHubs:
i.send(EventData)orsend(Iterable)ii.send(EventData, String)orsend(Iterable, String)iii.PartitionSender.send(EventData)orPartitionSender.send(Iterable)
createPartitionSender in interface IEventHubClientpartitionId - partitionId of EventHub to send the EventData's toServiceBusException - if Service Bus service encountered problems during connection creation.PartitionSenderpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, String startingOffset) throws ServiceBusException
createReceiver(String, String, String).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, String startingOffset) throws ServiceBusException
NOTE: There can be a maximum number of receivers that can run in parallel per ConsumerGroup per Partition. The limit is enforced by the Event Hub service - current limit is 5 receivers in parallel. Having multiple receivers reading from offsets that are far apart on the same consumer group / partition combo will have significant performance Impact.
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive) throws ServiceBusException
createReceiver(String, String, String, boolean).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.EventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive) throws ServiceBusException
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.ServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, Instant dateTime) throws ServiceBusException
createReceiver(String, String, Instant).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.EventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, Instant dateTime) throws ServiceBusException
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.ServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, String startingOffset, ReceiverOptions receiverOptions) throws ServiceBusException
createReceiver(String, String, String).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMreceiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, String startingOffset, ReceiverOptions receiverOptions) throws ServiceBusException
NOTE: There can be a maximum number of receivers that can run in parallel per ConsumerGroup per Partition. The limit is enforced by the Event Hub service - current limit is 5 receivers in parallel. Having multiple receivers reading from offsets that are far apart on the same consumer group / partition combo will have significant performance Impact.
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMreceiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, ReceiverOptions receiverOptions) throws ServiceBusException
createReceiver(String, String, String, boolean).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.receiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, ReceiverOptions receiverOptions) throws ServiceBusException
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.receiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createReceiverSync(String consumerGroupName, String partitionId, Instant dateTime, ReceiverOptions receiverOptions) throws ServiceBusException
createReceiver(String, String, Instant).createReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.receiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createReceiver(String consumerGroupName, String partitionId, Instant dateTime, ReceiverOptions receiverOptions) throws ServiceBusException
createReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.receiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiverpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, String startingOffset, long epoch) throws ServiceBusException
createEpochReceiver(String, String, String, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMepoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.EventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, String startingOffset, long epoch) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMepoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.ServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, long epoch) throws ServiceBusException
createEpochReceiver(String, String, String, boolean, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.EventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, long epoch) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.ServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, Instant dateTime, long epoch) throws ServiceBusException
createEpochReceiver(String, String, Instant, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.EventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, Instant dateTime, long epoch) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.epoch - a unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.ServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, String startingOffset, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
createEpochReceiver(String, String, String, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMepoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, String startingOffset, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMepoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
createEpochReceiver(String, String, String, boolean, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, String startingOffset, boolean offsetInclusive, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.startingOffset - the offset to start receiving the events from. To receive from start of the stream use: PartitionReceiver.START_OF_STREAMoffsetInclusive - if set to true, the startingOffset is treated as an inclusive offset - meaning the first event returned is the one that has the starting offset. Normally first event returned is the event after the starting offset.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic final PartitionReceiver createEpochReceiverSync(String consumerGroupName, String partitionId, Instant dateTime, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
createEpochReceiver(String, String, Instant, long).createEpochReceiverSync in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.epoch - an unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverEventData.ServiceBusException - if Service Bus service encountered problems during the operation.public final CompletableFuture<PartitionReceiver> createEpochReceiver(String consumerGroupName, String partitionId, Instant dateTime, long epoch, ReceiverOptions receiverOptions) throws ServiceBusException
It is important to pay attention to the following when creating epoch based receiver:
createEpochReceiver in interface IEventHubClientconsumerGroupName - the consumer group name that this receiver should be grouped under.partitionId - the partition Id that the receiver belongs to. All data received will be from this partition only.dateTime - the date time instant that receive operations will start receive events from. Events received will have EventData.SystemProperties.getEnqueuedTime() later than this Instant.epoch - a unique identifier (epoch value) that the service uses, to enforce partition/lease ownership.receiverOptions - the set of options to enable on the event hubs receiverServiceBusException - if Service Bus service encountered problems during the operation.PartitionReceiver,
ReceiverDisconnectedExceptionpublic CompletableFuture<Void> onClose()
onClose in interface IEventHubClientonClose in class ClientEntitypublic CompletableFuture<EventHubRuntimeInformation> getRuntimeInformation()
EventHubRuntimeInformation for details).
Retries until it reaches the operation timeout, then either rethrows the last error if available or
returns null to indicate timeout.getRuntimeInformation in interface IEventHubClientpublic CompletableFuture<EventHubPartitionRuntimeInformation> getPartitionRuntimeInformation(String partitionId)
EventHubPartitionRuntimeInformation for
details. Retries until it reaches the operation timeout, then either rethrows the last error if available or
returns null to indicate timeout.getPartitionRuntimeInformation in interface IEventHubClientpartitionId - Partition to get information about. Must be one of the partition ids returned by getRuntimeInformation.Copyright © 2017. All rights reserved.