Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventProcessorHost

Package version

Describes the Event Processor Host to process events from an EventHub.

class

EventProcessorHost

Hierarchy

  • EventProcessorHost

Index

Constructors

constructor

  • Creates a new host to process events from an Event Hub.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • Optional options: EventProcessorHostOptions

    Returns EventProcessorHost

Accessors

consumerGroup

  • get consumerGroup(): string

hostName

  • get hostName(): string

receivingFromPartitions

  • get receivingFromPartitions(): string[]
  • Provides a list of partitions the EPH is currently receiving messages from.

    The EPH will try to grab leases for more partitions during each scan that happens once every (configured) lease renew seconds. The number of EPH instances that are being run simultaneously to receive messages from the same consumer group within an event hub also influences the number of partitions that this instance of EPH is actively receiving messages from.

    Returns string[]

    Array List of partitions that this EPH instance is currently receiving messages from.

Methods

getHubRuntimeInformation

  • getHubRuntimeInformation(): Promise<EventHubRuntimeInformation>
  • Provides the eventhub runtime information.

    Returns Promise<EventHubRuntimeInformation>

getPartitionIds

  • getPartitionIds(): Promise<string[]>

getPartitionInformation

  • getPartitionInformation(partitionId: string | number): Promise<EventHubPartitionRuntimeInformation>
  • Provides information about the specified partition.

    Parameters

    • partitionId: string | number

      Partition ID for which partition information is required.

    Returns Promise<EventHubPartitionRuntimeInformation>

    EventHubPartitionRuntimeInformation

start

  • Starts the event processor host, fetching the list of partitions, and attempting to grab leases For each successful lease, it will get the details from the blob and start a receiver at the point where it left off previously.

    Parameters

    Returns Promise<void>

stop

  • stop(): Promise<void>

Static createFromAadTokenCredentials

  • createFromAadTokenCredentials(hostName: string, storageConnectionString: string, storageContainerName: string, namespace: string, eventHubPath: string, credentials: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials, options?: FromTokenProviderOptions): EventProcessorHost
  • Creates an EventProcessorHost instance from AAD token credentials.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • storageConnectionString: string

      Connection string to Azure Storage account used for leases and checkpointing. Example DefaultEndpointsProtocol=https;AccountName=; AccountKey=;EndpointSuffix=core.windows.net

    • storageContainerName: string

      Azure Storage container name for use by built-in lease and checkpoint manager.

    • namespace: string

      Fully qualified domain name for Event Hubs. Example: "{your-sb-namespace}.servicebus.windows.net"

    • eventHubPath: string

      The name of the EventHub.

    • credentials: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials

      The AAD Token credentials. It can be one of the following: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials.

    • Optional options: FromTokenProviderOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createFromAadTokenCredentialsWithCustomCheckpointAndLeaseManager

  • createFromAadTokenCredentialsWithCustomCheckpointAndLeaseManager(hostName: string, namespace: string, eventHubPath: string, credentials: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials, checkpointManager: CheckpointManager, leaseManager: LeaseManager, options?: FromTokenProviderOptions): EventProcessorHost
  • Creates an EventProcessorHost instance from AAD token credentials with the given checkpoint manager and lease manager.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • namespace: string

      Fully qualified domain name for Event Hubs. Example: "{your-sb-namespace}.servicebus.windows.net"

    • eventHubPath: string

      The name of the EventHub.

    • credentials: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials

      The AAD Token credentials. It can be one of the following: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials.

    • checkpointManager: CheckpointManager

      A manager to manage checkpoints.

    • leaseManager: LeaseManager

      A manager to manage leases.

    • Optional options: FromTokenProviderOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createFromConnectionString

  • Creates an EventProcessorHost instance from the EventHub connection string.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • storageConnectionString: string

      Connection string to Azure Storage account used for leases and checkpointing. Example DefaultEndpointsProtocol=https;AccountName=; AccountKey=;EndpointSuffix=core.windows.net

    • storageContainerName: string

      Azure Storage container name for use by built-in lease and checkpoint manager.

    • eventHubConnectionString: string

      Connection string for the Event Hub to receive from. Example: 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/; SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key'

    • Optional options: FromConnectionStringOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createFromConnectionStringWithCustomCheckpointAndLeaseManager

  • Creates an EventProcessorHost instance from the EventHub connection string with the provided checkpoint manager and lease manager.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • eventHubConnectionString: string

      Connection string for the Event Hub to receive from. Example: 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/; SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key'

    • checkpointManager: CheckpointManager

      A manager to manage checkpoints.

    • leaseManager: LeaseManager

      A manager to manage leases.

    • Optional options: FromConnectionStringOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createFromIotHubConnectionString

  • Creates an EventProcessorHost instance from the IotHub connection string.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • storageConnectionString: string

      Connection string to Azure Storage account used for leases and checkpointing. Example DefaultEndpointsProtocol=https;AccountName=; AccountKey=;EndpointSuffix=core.windows.net

    • storageContainerName: string

      Azure Storage container name for use by built-in lease and checkpoint manager.

    • iotHubConnectionString: string

      Connection string for the IotHub. Example: 'Endpoint=iot-host-name;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key'

    • Optional options: FromIotHubConnectionStringOptions

    Returns Promise<EventProcessorHost>

    EventProcessorHost

Static createFromIotHubConnectionStringWithCustomCheckpointAndLeaseManager

  • Creates an EventProcessorHost instance from the IotHub connection string with the given checkpoint manager and lease manager.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • iotHubConnectionString: string

      Connection string for the IotHub. Example: 'Endpoint=iot-host-name;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key'

    • checkpointManager: CheckpointManager

      A manager to manage checkpoints.

    • leaseManager: LeaseManager

      A manager to manage leases.

    • Optional options: FromIotHubConnectionStringOptions

    Returns Promise<EventProcessorHost>

    EventProcessorHost

Static createFromTokenProvider

  • createFromTokenProvider(hostName: string, storageConnectionString: string, storageContainerName: string, namespace: string, eventHubPath: string, tokenProvider: TokenProvider, options?: FromTokenProviderOptions): EventProcessorHost
  • Creates an EventProcessorHost instance from a TokenProvider.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • storageConnectionString: string

      Connection string to Azure Storage account used for leases and checkpointing. Example DefaultEndpointsProtocol=https;AccountName=; AccountKey=;EndpointSuffix=core.windows.net

    • storageContainerName: string

      Azure Storage container name for use by built-in lease and checkpoint manager.

    • namespace: string

      Fully qualified domain name for Event Hubs. Example: "{your-sb-namespace}.servicebus.windows.net"

    • eventHubPath: string

      The name of the EventHub.

    • tokenProvider: TokenProvider

      Your token provider that implements the TokenProvider interface.

    • Optional options: FromTokenProviderOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createFromTokenProviderWithCustomCheckpointAndLeaseManager

  • Creates an EventProcessorHost instance from a TokenProvider with the provided checkpoint manager and lease manager.

    Parameters

    • hostName: string

      Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid or a prefix with a guid to ensure uniqueness. You can use EventProcessorHost.createHostName("your-prefix"); Default: js-host-${uuid()}.

    • namespace: string

      Fully qualified domain name for Event Hubs. Example: "{your-sb-namespace}.servicebus.windows.net"

    • eventHubPath: string

      The name of the EventHub.

    • tokenProvider: TokenProvider

      Your token provider that implements the TokenProvider interface.

    • checkpointManager: CheckpointManager

      A manager to manage checkpoints.

    • leaseManager: LeaseManager

      A manager to manage leases.

    • Optional options: FromTokenProviderOptions

    Returns EventProcessorHost

    EventProcessorHost

Static createHostName

  • createHostName(prefix?: undefined | string): string
  • Convenience method for generating unique host name.

    Parameters

    • Optional prefix: undefined | string

    Returns string

    A unique host name

Generated using TypeDoc