Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PartitionProcessor

Package version

The PartitionProcessor is responsible for processing events received from Event Hubs when using EventProcessor

The EventProcessor creates a new instance of the PartitionProcessor for each partition of the event hub it starts processing. When you extend the PartitionProcessor in order to customize it as you see fit,

  • Override the processEvents() method to add the code to process the received events. This is also a good place to update the checkpoints using the updateCheckpoint() method
  • Optionally override the processError() method to handle any error that might have occurred when processing the events.
  • Optionally override the initialize() method to implement any set up related tasks you would want to carry out before starting to receive events from the partition
  • Optionally override the close() method to implement any tear down or clean up tasks you would want to carry out.

Hierarchy

  • PartitionProcessor

Index

Accessors

consumerGroupName

  • get consumerGroupName(): string
  • set consumerGroupName(consumerGroupName: string): void
  • property

    The name of the consumer group from where the current partition is being processed. It is set by the EventProcessor

    readonly

    Returns string

  • property

    The name of the consumer group from where the current partition is being processed. It is set by the EventProcessor

    Parameters

    • consumerGroupName: string

    Returns void

eventHubName

  • get eventHubName(): string
  • set eventHubName(eventHubName: string): void
  • property

    The name of the event hub to which the current partition belongs. It is set by the EventProcessor

    readonly

    Returns string

  • property

    The name of the event hub to which the current partition belongs. It is set by the EventProcessor

    Parameters

    • eventHubName: string

    Returns void

eventProcessorId

  • get eventProcessorId(): string
  • set eventProcessorId(eventProcessorId: string): void
  • property

    The unique identifier of the EventProcessor that has spawned the current instance of PartitionProcessor. This is set by the EventProcessor

    Returns string

  • property

    The unique identifier of the EventProcessor that has spawned the current instance of PartitionProcessor. This is set by the EventProcessor

    Parameters

    • eventProcessorId: string

    Returns void

fullyQualifiedNamespace

  • get fullyQualifiedNamespace(): string
  • set fullyQualifiedNamespace(fullyQualifiedNamespace: string): void
  • property

    The fully qualified namespace from where the current partition is being processed. It is set by the EventProcessor

    readonly

    Returns string

  • property

    The fully qualified namespace from where the current partition is being processed. It is set by the EventProcessor

    Parameters

    • fullyQualifiedNamespace: string

    Returns void

lastEnqueuedEventInfo

  • property

    Information on the last enqueued event in the partition that is being processed. This property is updated by the EventProcessor if the trackLastEnqueuedEventInfo option is set to true when creating an instance of EventProcessor

    readonly

    Returns LastEnqueuedEventInfo

  • property

    Information on the last enqueued event in the partition that is being processed. This property is updated by the EventProcessor if the trackLastEnqueuedEventInfo option is set to true when creating an instance of EventProcessor

    Parameters

    Returns void

partitionId

  • get partitionId(): string
  • set partitionId(partitionId: string): void
  • property

    The identifier of the Event Hub partition that is being processed. It is set by the EventProcessor

    readonly

    Returns string

  • property

    The identifier of the Event Hub partition that is being processed. It is set by the EventProcessor

    Parameters

    • partitionId: string

    Returns void

partitionManager

Methods

close

  • This method is called before the partition processor is closed by the EventProcessor.

    Parameters

    • reason: CloseReason

      The reason for closing this partition processor.

    Returns Promise<void>

initialize

  • initialize(): Promise<void>
  • This method is called when the EventProcessor takes ownership of a new partition and before any events are received.

    Returns Promise<void>

processError

  • processError(error: Error): Promise<void>
  • This method is called when an error occurs while receiving events from Event Hubs.

    Parameters

    • error: Error

      The error to be processed.

    Returns Promise<void>

processEvents

  • This method is called when new events are received.

    This is also a good place to update checkpoints as appropriate.

    Parameters

    Returns Promise<void>

updateCheckpoint

  • updateCheckpoint(eventData: ReceivedEventData): Promise<void>
  • updateCheckpoint(sequenceNumber: number, offset: number): Promise<void>
  • Updates the checkpoint using the event data.

    A checkpoint is meant to represent the last successfully processed event by the user from a particular partition of a consumer group in an Event Hub instance.

    Parameters

    • eventData: ReceivedEventData

      The event that you want to update the checkpoint with.

    Returns Promise<void>

    Promise

  • Updates the checkpoint using the given offset and sequence number.

    A checkpoint is meant to represent the last successfully processed event by the user from a particular partition of a consumer group in an Event Hub instance.

    Parameters

    • sequenceNumber: number

      The sequence number of the event that you want to update the checkpoint with.

    • offset: number

      The offset of the event that you want to update the checkpoint with.

    Returns Promise<void>

    Promise.

Generated using TypeDoc