EventProcessorClient Class

Definition

EventProcessorClient provides a convenient mechanism to consume events from all partitions of an Event Hub in the context of a consumer group. Event Processor-based application consists of one or more instances of EventProcessorClient(s) which are set up to consume events from the same Event Hub, consumer group to balance the workload across different instances and track progress when events are processed. Based on the number of instances running, each EventProcessorClient may own zero or more partitions to balance the workload among all the instances.

To create an instance of EventProcessorClient, use the fluent EventProcessorClientBuilder.

public class EventProcessorClient
Inheritance
java.lang.Object
EventProcessorClient

Inherited Members

java.lang.Object.clone()
java.lang.Object.equals(java.lang.Object)
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.hashCode()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.toString()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Methods

getIdentifier()

The identifier is a unique name given to this event processor instance.

isRunning()

Returns true if the event processor is running. If the event processor is already running, calling #start() has no effect.

start()

Starts processing of events for all partitions of the Event Hub that this event processor can own, assigning a dedicated PartitionProcessor to each partition. If there are other Event Processors active for the same consumer group on the Event Hub, responsibility for partitions will be shared between them.

Subsequent calls to start will be ignored if this event processor is already running. Calling start after #stop() is called will restart this event processor.

Starting the processor to consume events from all partitions

eventProcessorClient.start();
 // Continue to perform other tasks while the processor is running in the background.
 eventProcessorClient.stop();
stop()

Stops processing events for all partitions owned by this event processor. All PartitionProcessor will be shutdown and any open resources will be closed.

Subsequent calls to stop will be ignored if the event processor is not running.

Stopping the processor

eventProcessorClient.start();
 // Continue to perform other tasks while the processor is running in the background.
 eventProcessorClient.stop();

Applies to