The name of the consumer group from which you want to process events.
The connection string to use for connecting to the Event Hub instance. It is expected that the shared key properties and the Event Hub path are contained in this connection string. e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.The name of the consumer group from which you want to process events.
The connection string to use for connecting to the Event Hub instance. It is expected that the shared key properties and the Event Hub path are contained in this connection string. e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.
A checkpoint store that is used by the client to read checkpoints to determine the position from where it should resume receiving events when your application gets restarted. It is also used by the client to load balance multiple instances of your application.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.The name of the consumer group from which you want to process events.
The connection string to use for connecting to the Event Hub instance. It is expected that the shared key properties and the Event Hub path are contained in this connection string. e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.
The name of the specific Event Hub to connect the client to.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.The name of the consumer group from which you want to process events.
The connection string to use for connecting to the Event Hub instance. It is expected that the shared key properties and the Event Hub path are contained in this connection string. e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.
The name of the specific Event Hub to connect the client to.
A checkpoint store that is used by the client to read checkpoints to determine the position from where it should resume receiving events when your application gets restarted. It is also used by the client to load balance multiple instances of your application.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.The name of the consumer group from which you want to process events.
The full namespace which is likely to be similar to
The name of the specific Event Hub to connect the client to.
An credential object used by the client to get the token to authenticate the connection with the Azure Event Hubs service. See @azure/identity for creating the credentials.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.The name of the consumer group from which you want to process events.
The full namespace which is likely to be similar to
The name of the specific Event Hub to connect the client to.
An credential object used by the client to get the token to authenticate the connection with the Azure Event Hubs service. See @azure/identity for creating the credentials.
A checkpoint store that is used by the client to read checkpoints to determine the position from where it should resume receiving events when your application gets restarted. It is also used by the client to load balance multiple instances of your application.
A set of options to apply when configuring the client.
retryOptions
: Configures the retry policy for all the operations on the client.
For example, { "maxRetries": 4 }
or { "maxRetries": 4, "retryDelayInMs": 30000 }
.webSocketOptions
: Configures the channelling of the AMQP connection over Web Sockets.userAgent
: A string to append to the built in user agent string that is passed to the service.Closes the AMQP connection to the Event Hub instance, returning a promise that will be resolved when disconnection is completed.
Promise
Provides the Event Hub runtime information.
The set of options to apply to the operation call.
A promise that resolves with information about the Event Hub instance.
Provides the id for each partition associated with the Event Hub.
The set of options to apply to the operation call.
A promise that resolves with an Array of strings representing the id for each partition associated with the Event Hub.
Provides information about the state of the specified partition.
The id of the partition for which information is required.
The set of options to apply to the operation call.
A promise that resolves with information about the state of the partition .
Subscribe to events from all partitions.
If checkpoint store is provided to the EventHubConsumerClient
and there are multiple
instances of your application, then each instance will subscribe to a subset of the
partitions such that the load is balanced amongst them.
Call close() on the returned object to stop receiving events.
Example usage:
const client = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName);
const subscription = client.subscribe(
{
processEvents: (events, context) => { console.log("Received event count: ", events.length) },
processError: (err, context) => { console.log("Error: ", err) }
},
{ startPosition: earliestEventPosition }
);
Handlers for the lifecycle of the subscription - subscription initialization per partition, receiving events, handling errors and the closing of a subscription per partition.
Configures the way events are received.
Most common are maxBatchSize
and maxWaitTimeInSeconds
that control the flow of
events to the handler provided to receive events as well as the start position. For example,
`{ maxBatchSize: 20, maxWaitTimeInSeconds: 120, startPosition: { sequenceNumber: 123 } }
Subscribe to events from a single partition. Call close() on the returned object to stop receiving events.
Example usage:
const client = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName);
const subscription = client.subscribe(
partitionId,
{
processEvents: (events, context) => { console.log("Received event count: ", events.length) },
processError: (err, context) => { console.log("Error: ", err) }
},
{ startPosition: earliestEventPosition }
);
The id of the partition to subscribe to.
Handlers for the lifecycle of the subscription - subscription initialization of the partition, receiving events, handling errors and the closing of a subscription to the partition.
Configures the way events are received.
Most common are maxBatchSize
and maxWaitTimeInSeconds
that control the flow of
events to the handler provided to receive events as well as the start position. For example,
`{ maxBatchSize: 20, maxWaitTimeInSeconds: 120, startPosition: { sequenceNumber: 123 } }
Generated using TypeDoc
The
EventHubConsumerClient
class is used to consume events from an Event Hub.There are multiple ways to create an
EventHubConsumerClient
<yournamespace>.servicebus.windows.net
, and a credentials object.Optionally, you can also pass: