Class EventProcessorClientBuilder
- All Implemented Interfaces:
com.azure.core.amqp.client.traits.AmqpTrait<EventProcessorClientBuilder>
,com.azure.core.client.traits.AzureNamedKeyCredentialTrait<EventProcessorClientBuilder>
,com.azure.core.client.traits.AzureSasCredentialTrait<EventProcessorClientBuilder>
,com.azure.core.client.traits.ConfigurationTrait<EventProcessorClientBuilder>
,com.azure.core.client.traits.ConnectionStringTrait<EventProcessorClientBuilder>
,com.azure.core.client.traits.TokenCredentialTrait<EventProcessorClientBuilder>
EventProcessorClient
. Calling buildEventProcessorClient()
constructs a new instance of EventProcessorClient
.
To create an instance of EventProcessorClient
, the following fields are required:
Consumer group name
.CheckpointStore
- An implementation of CheckpointStore that stores checkpoint and partition ownership information to enable load balancing and checkpointing processed events.processEvent
orprocessEventBatch
- A callback that processes events received from the Event Hub.processError
- A callback that handles errors that may occur while running the EventProcessorClient.- Credentials to perform operations against Azure Event Hubs. They can be set by using one of the following
methods:
connectionString(String)
with a connection string to a specific Event Hub.connectionString(String, String)
with an Event Hub namespace connection string and the Event Hub name.credential(String, String, TokenCredential)
with the fully qualified namespace, Event Hub name, and a set of credentials authorized to use the Event Hub.credential(TokenCredential)
,credential(AzureSasCredential)
, orcredential(AzureNamedKeyCredential)
along withfullyQualifiedNamespace(String)
andeventHubName(String)
. The fully qualified namespace, Event Hub name, and authorized credentials to use the Event Hub.
Creating an EventProcessorClient
public EventProcessorClient createEventProcessor() { String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() .consumerGroup("consumer-group") .checkpointStore(new SampleCheckpointStore()) .processEvent(eventContext -> { System.out.printf("Partition id = %s and sequence number of event = %s%n", eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber()); }) .processError(errorContext -> { System.out.printf("Error occurred in partition processor for partition %s, %s%n", errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable()); }) .connectionString(connectionString) .buildEventProcessorClient(); return eventProcessorClient; }
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis will create a newEventProcessorClient
configured with the options set in this builder.checkpointStore
(CheckpointStore checkpointStore) Sets theCheckpointStore
theEventProcessorClient
will use for storing partition ownership and checkpoint information.clientOptions
(com.azure.core.util.ClientOptions clientOptions) Sets the client options for the processor client.configuration
(com.azure.core.util.Configuration configuration) Sets the configuration store that is used during construction of the service client.connectionString
(String connectionString) Sets the credential information given a connection string to the Event Hub instance.connectionString
(String connectionString, String eventHubName) Sets the credential information given a connection string to the Event Hubs namespace and name to a specific Event Hub instance.consumerGroup
(String consumerGroup) Sets the consumer group name from which theEventProcessorClient
should consume events.credential
(com.azure.core.credential.AzureNamedKeyCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.credential
(com.azure.core.credential.AzureSasCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.credential
(com.azure.core.credential.TokenCredential credential) Sets theTokenCredential
used to authorize requests sent to the service.credential
(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.AzureNamedKeyCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.credential
(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.AzureSasCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.credential
(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.TokenCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.customEndpointAddress
(String customEndpointAddress) Sets a custom endpoint address when connecting to the Event Hubs service.eventHubName
(String eventHubName) Sets the name of the Event Hub to connect the client to.fullyQualifiedNamespace
(String fullyQualifiedNamespace) Sets the fully qualified name for the Event Hubs namespace.initialPartitionEventPosition
(Map<String, EventPosition> initialPartitionEventPosition) Sets the map containing the event position to use for each partition if a checkpoint for the partition does not exist inCheckpointStore
.loadBalancingStrategy
(LoadBalancingStrategy loadBalancingStrategy) TheLoadBalancingStrategy
theevent processor
will use for claiming partition ownership.loadBalancingUpdateInterval
(Duration loadBalancingUpdateInterval) The time interval between load balancing update cycles.partitionOwnershipExpirationInterval
(Duration partitionOwnershipExpirationInterval) The time duration after which the ownership of partition expires if it's not renewed by the owning processor instance.prefetchCount
(int prefetchCount) Sets the count used by the receivers to control the number of events each consumer will actively receive and queue locally without regard to whether a receive operation is currently active.processError
(Consumer<ErrorContext> processError) The function that is called when an error occurs while processing events.processEvent
(Consumer<EventContext> processEvent) The function that is called for each event received by thisEventProcessorClient
.processEvent
(Consumer<EventContext> processEvent, Duration maxWaitTime) The function that is called for each event received by thisEventProcessorClient
.processEventBatch
(Consumer<EventBatchContext> processEventBatch, int maxBatchSize) The function that is called for each event received by thisEventProcessorClient
.processEventBatch
(Consumer<EventBatchContext> processEventBatch, int maxBatchSize, Duration maxWaitTime) The function that is called for each event received by thisEventProcessorClient
.processPartitionClose
(Consumer<CloseContext> closePartition) The function that is called when a processing for a partition stops.processPartitionInitialization
(Consumer<InitializationContext> initializePartition) The function that is called before processing starts for a partition.proxyOptions
(com.azure.core.amqp.ProxyOptions proxyOptions) Sets the proxy configuration to use forEventHubAsyncClient
.retry
(com.azure.core.amqp.AmqpRetryOptions retryOptions) Deprecated.retryOptions
(com.azure.core.amqp.AmqpRetryOptions retryOptions) Sets the retry policy forEventHubAsyncClient
.trackLastEnqueuedEventProperties
(boolean trackLastEnqueuedEventProperties) Sets whether or not the event processor should request information on the last enqueued event on its associated partition, and track that information as events are received.transportType
(com.azure.core.amqp.AmqpTransportType transport) Sets the transport type by which all the communication with Azure Event Hubs occurs.
-
Field Details
-
DEFAULT_LOAD_BALANCING_UPDATE_INTERVAL
Default load balancing update interval. Balancing interval should account for latency between the client and the storage account. -
DEFAULT_OWNERSHIP_EXPIRATION_INTERVAL
Default ownership expiration.
-
-
Constructor Details
-
EventProcessorClientBuilder
public EventProcessorClientBuilder()Creates a new instance ofEventProcessorClientBuilder
.
-
-
Method Details
-
fullyQualifiedNamespace
Sets the fully qualified name for the Event Hubs namespace.- Parameters:
fullyQualifiedNamespace
- The fully qualified name for the Event Hubs namespace. This is likely to be similar to "{your-namespace}.servicebus.windows.net".- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- iffullyQualifiedNamespace
is an empty string.NullPointerException
- iffullyQualifiedNamespace
is null.
-
eventHubName
Sets the name of the Event Hub to connect the client to.- Parameters:
eventHubName
- The name of the Event Hub to connect the client to.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- ifeventHubName
is an empty string.NullPointerException
- ifeventHubName
is null.
-
connectionString
Sets the credential information given a connection string to the Event Hub instance.If the connection string is copied from the Event Hubs namespace, it will likely not contain the name to the desired Event Hub, which is needed. In this case, the name can be added manually by adding "EntityPath=EVENT_HUB_NAME" to the end of the connection string. For example, "EntityPath=telemetry-hub".
If you have defined a shared access policy directly on the Event Hub itself, then copying the connection string from that Event Hub will result in a connection string that contains the name.
- Specified by:
connectionString
in interfacecom.azure.core.client.traits.ConnectionStringTrait<EventProcessorClientBuilder>
- Parameters:
connectionString
- The connection string to use for connecting to the Event Hub instance. It is expected that the Event Hub name and the shared access key properties are contained in this connection string.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
NullPointerException
- ifconnectionString
isnull
.IllegalArgumentException
- ifconnectionString
is empty. Or, theconnectionString
does not contain the "EntityPath" key, which is the name of the Event Hub instance.com.azure.core.exception.AzureException
- If the shared access signature token credential could not be created using the connection string.
-
connectionString
Sets the credential information given a connection string to the Event Hubs namespace and name to a specific Event Hub instance.- Parameters:
connectionString
- The connection string to use for connecting to the Event Hubs namespace; it is expected that the shared access key properties are contained in this connection string, but not the Event Hub name.eventHubName
- The name of the Event Hub to connect the client to.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
NullPointerException
- ifconnectionString
oreventHubName
is null.IllegalArgumentException
- ifconnectionString
oreventHubName
is an empty string. Or, if theconnectionString
contains the Event Hub name.com.azure.core.exception.AzureException
- If the shared access signature token credential could not be created using the connection string.
-
configuration
Sets the configuration store that is used during construction of the service client. If not specified, the default configuration store is used to configure theEventHubAsyncClient
. UseConfiguration.NONE
to bypass using configuration settings during construction.- Specified by:
configuration
in interfacecom.azure.core.client.traits.ConfigurationTrait<EventProcessorClientBuilder>
- Parameters:
configuration
- The configuration store used to configure theEventHubAsyncClient
.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
credential
public EventProcessorClientBuilder credential(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.TokenCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.- Parameters:
fullyQualifiedNamespace
- The fully qualified name for the Event Hubs namespace. This is likely to be similar to "{your-namespace}.servicebus.windows.net".eventHubName
- The name of the Event Hub to connect the client to.credential
- The token credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- iffullyQualifiedNamespace
oreventHubName
is an empty string.NullPointerException
- iffullyQualifiedNamespace
,eventHubName
,credentials
is null.
-
credential
Sets theTokenCredential
used to authorize requests sent to the service. Refer to the Azure SDK for Java identity and authentication documentation for more details on proper usage of theTokenCredential
type.- Specified by:
credential
in interfacecom.azure.core.client.traits.TokenCredentialTrait<EventProcessorClientBuilder>
- Parameters:
credential
- The token credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
NullPointerException
- ifcredential
is null.
-
credential
public EventProcessorClientBuilder credential(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.AzureNamedKeyCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.- Parameters:
fullyQualifiedNamespace
- The fully qualified name for the Event Hubs namespace. This is likely to be similar to "{your-namespace}.servicebus.windows.net".eventHubName
- The name of the Event Hub to connect the client to.credential
- The shared access name and key credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- iffullyQualifiedNamespace
oreventHubName
is an empty string.NullPointerException
- iffullyQualifiedNamespace
,eventHubName
,credentials
is null.
-
credential
public EventProcessorClientBuilder credential(com.azure.core.credential.AzureNamedKeyCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.- Specified by:
credential
in interfacecom.azure.core.client.traits.AzureNamedKeyCredentialTrait<EventProcessorClientBuilder>
- Parameters:
credential
- The shared access name and key credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
NullPointerException
- ifcredentials
is null.
-
credential
public EventProcessorClientBuilder credential(String fullyQualifiedNamespace, String eventHubName, com.azure.core.credential.AzureSasCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.- Parameters:
fullyQualifiedNamespace
- The fully qualified name for the Event Hubs namespace. This is likely to be similar to "{your-namespace}.servicebus.windows.net".eventHubName
- The name of the Event Hub to connect the client to.credential
- The shared access signature credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- iffullyQualifiedNamespace
oreventHubName
is an empty string.NullPointerException
- iffullyQualifiedNamespace
,eventHubName
,credentials
is null.
-
credential
public EventProcessorClientBuilder credential(com.azure.core.credential.AzureSasCredential credential) Sets the credential information for which Event Hub instance to connect to, and how to authorize against it.- Specified by:
credential
in interfacecom.azure.core.client.traits.AzureSasCredentialTrait<EventProcessorClientBuilder>
- Parameters:
credential
- The shared access signature credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
NullPointerException
- ifcredentials
is null.
-
customEndpointAddress
Sets a custom endpoint address when connecting to the Event Hubs service. This can be useful when your network does not allow connecting to the standard Azure Event Hubs endpoint address, but does allow connecting through an intermediary. For example: https://my.custom.endpoint.com:55300.If no port is specified, the default port for the
transport type
is used.- Parameters:
customEndpointAddress
- The custom endpoint address.- Returns:
- The updated
EventProcessorClientBuilder
object. - Throws:
IllegalArgumentException
- ifcustomEndpointAddress
cannot be parsed into a validURL
.
-
proxyOptions
Sets the proxy configuration to use forEventHubAsyncClient
. When a proxy is configured,AmqpTransportType.AMQP_WEB_SOCKETS
must be used for the transport type.- Specified by:
proxyOptions
in interfacecom.azure.core.amqp.client.traits.AmqpTrait<EventProcessorClientBuilder>
- Parameters:
proxyOptions
- The proxy options to use.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
transportType
Sets the transport type by which all the communication with Azure Event Hubs occurs. Default value isAmqpTransportType.AMQP
.- Specified by:
transportType
in interfacecom.azure.core.amqp.client.traits.AmqpTrait<EventProcessorClientBuilder>
- Parameters:
transport
- The transport type to use.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
retry
@Deprecated public EventProcessorClientBuilder retry(com.azure.core.amqp.AmqpRetryOptions retryOptions) Deprecated.Replaced byretryOptions(AmqpRetryOptions)
.Sets the retry policy forEventHubAsyncClient
. If not specified, the default retry options are used.- Parameters:
retryOptions
- The retry policy to use.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
retryOptions
Sets the retry policy forEventHubAsyncClient
. If not specified, the default retry options are used.- Specified by:
retryOptions
in interfacecom.azure.core.amqp.client.traits.AmqpTrait<EventProcessorClientBuilder>
- Parameters:
retryOptions
- The retry options to use.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
clientOptions
Sets the client options for the processor client. The application id set on the client options will be used for tracing. The headers set onClientOptions
are currently not used but can be used in later releases to add to AMQP message.- Specified by:
clientOptions
in interfacecom.azure.core.amqp.client.traits.AmqpTrait<EventProcessorClientBuilder>
- Parameters:
clientOptions
- The client options.- Returns:
- The updated
EventProcessorClientBuilder
object.
-
consumerGroup
Sets the consumer group name from which theEventProcessorClient
should consume events.- Parameters:
consumerGroup
- The consumer group name thisEventProcessorClient
should consume events.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifconsumerGroup
isnull
.
-
checkpointStore
Sets theCheckpointStore
theEventProcessorClient
will use for storing partition ownership and checkpoint information.Users can, optionally, provide their own implementation of
CheckpointStore
which will store ownership and checkpoint information.- Parameters:
checkpointStore
- Implementation ofCheckpointStore
.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifcheckpointStore
isnull
.
-
loadBalancingUpdateInterval
public EventProcessorClientBuilder loadBalancingUpdateInterval(Duration loadBalancingUpdateInterval) The time interval between load balancing update cycles. This is also generally the interval at which ownership of partitions are renewed. By default, this interval is set to 10 seconds.- Parameters:
loadBalancingUpdateInterval
- The time duration between load balancing update cycles.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifloadBalancingUpdateInterval
isnull
.IllegalArgumentException
- ifloadBalancingUpdateInterval
is zero or a negative duration.
-
partitionOwnershipExpirationInterval
public EventProcessorClientBuilder partitionOwnershipExpirationInterval(Duration partitionOwnershipExpirationInterval) The time duration after which the ownership of partition expires if it's not renewed by the owning processor instance. This is the duration that this processor instance will wait before taking over the ownership of partitions previously owned by an inactive processor. By default, this duration is set to a minute.- Parameters:
partitionOwnershipExpirationInterval
- The time duration after which the ownership of partition expires.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifpartitionOwnershipExpirationInterval
isnull
.IllegalArgumentException
- ifpartitionOwnershipExpirationInterval
is zero or a negative duration.
-
loadBalancingStrategy
public EventProcessorClientBuilder loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy) TheLoadBalancingStrategy
theevent processor
will use for claiming partition ownership. By default, aBalanced
approach will be used.- Parameters:
loadBalancingStrategy
- TheLoadBalancingStrategy
to use.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifloadBalancingStrategy
isnull
.
-
prefetchCount
Sets the count used by the receivers to control the number of events each consumer will actively receive and queue locally without regard to whether a receive operation is currently active.- Parameters:
prefetchCount
- The number of events to queue locally.- Returns:
- The updated
EventHubClientBuilder
object. - Throws:
IllegalArgumentException
- ifprefetchCount
is less than 1 or greater than 8000.
-
processEvent
The function that is called for each event received by thisEventProcessorClient
. The input contains the partition context and the event data.- Parameters:
processEvent
- The callback that's called when an event is received by thisEventProcessorClient
.- Returns:
- The updated
EventProcessorClientBuilder
instance. - Throws:
NullPointerException
- ifprocessEvent
isnull
.
-
processEvent
public EventProcessorClientBuilder processEvent(Consumer<EventContext> processEvent, Duration maxWaitTime) The function that is called for each event received by thisEventProcessorClient
. The input contains the partition context and the event data. If the max wait time is set, the receive will wait for that duration to receive an event and if is no event received, the consumer will be invoked with a null event data.- Parameters:
processEvent
- The callback that's called when an event is received by thisEventProcessorClient
or when the max wait duration has expired.maxWaitTime
- The max time duration to wait to receive an event before invoking this handler.- Returns:
- The updated
EventProcessorClient
instance. - Throws:
NullPointerException
- ifprocessEvent
isnull
.
-
processEventBatch
public EventProcessorClientBuilder processEventBatch(Consumer<EventBatchContext> processEventBatch, int maxBatchSize) The function that is called for each event received by thisEventProcessorClient
. The input contains the partition context and the event data. If the max wait time is set, the receive will wait for that duration to receive an event and if is no event received, the consumer will be invoked with a null event data.- Parameters:
processEventBatch
- The callback that's called when an event is received by thisEventProcessorClient
or when the max wait duration has expired.maxBatchSize
- The maximum number of events that will be in the list when this callback is invoked.- Returns:
- The updated
EventProcessorClient
instance. - Throws:
NullPointerException
- ifprocessEvent
isnull
.
-
processEventBatch
public EventProcessorClientBuilder processEventBatch(Consumer<EventBatchContext> processEventBatch, int maxBatchSize, Duration maxWaitTime) The function that is called for each event received by thisEventProcessorClient
. The input contains the partition context and the event data. If the max wait time is set, the receive will wait for that duration to receive an event and if is no event received, the consumer will be invoked with a null event data.EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() .consumerGroup("consumer-group") .checkpointStore(new SampleCheckpointStore()) .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(eventData -> { System.out.printf("Partition id = %s and sequence number of event = %s%n", eventBatchContext.getPartitionContext().getPartitionId(), eventData.getSequenceNumber()); }); }, 50, Duration.ofSeconds(30)) .processError(errorContext -> { System.out.printf("Error occurred in partition processor for partition %s, %s%n", errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable()); }) .connectionString(connectionString) .buildEventProcessorClient();
- Parameters:
processEventBatch
- The callback that's called when an event is received or when the max wait duration has expired.maxBatchSize
- The maximum number of events that will be in the list when this callback is invoked.maxWaitTime
- The max time duration to wait to receive a batch of events upto the max batch size before invoking this callback.- Returns:
- The updated
EventProcessorClient
instance. - Throws:
NullPointerException
- ifprocessEvent
isnull
.
-
processError
The function that is called when an error occurs while processing events. The input contains the partition information where the error happened.- Parameters:
processError
- The callback that's called when an error occurs while processing events.- Returns:
- The updated
EventProcessorClientBuilder
instance.
-
processPartitionInitialization
public EventProcessorClientBuilder processPartitionInitialization(Consumer<InitializationContext> initializePartition) The function that is called before processing starts for a partition. The input contains the partition information along with a default starting position for processing events that will be used in the case of a checkpoint unavailable inCheckpointStore
. Users can update this position if a different starting position is preferred.- Parameters:
initializePartition
- The callback that's called before processing starts for a partition- Returns:
- The updated
EventProcessorClientBuilder
instance.
-
processPartitionClose
The function that is called when a processing for a partition stops. The input contains the partition information along with the reason for stopping the event processing for this partition.- Parameters:
closePartition
- The callback that's called after processing for a partition stops.- Returns:
- The updated
EventProcessorClientBuilder
instance.
-
trackLastEnqueuedEventProperties
public EventProcessorClientBuilder trackLastEnqueuedEventProperties(boolean trackLastEnqueuedEventProperties) Sets whether or not the event processor should request information on the last enqueued event on its associated partition, and track that information as events are received.When information about the partition's last enqueued event is being tracked, each event received from the Event Hubs service will carry metadata about the partition that it otherwise would not. This results in a small amount of additional network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client.
- Parameters:
trackLastEnqueuedEventProperties
-true
if the resulting events will keep track of the last enqueued information for that partition;false
otherwise.- Returns:
- The updated
EventProcessorClientBuilder
instance.
-
initialPartitionEventPosition
public EventProcessorClientBuilder initialPartitionEventPosition(Map<String, EventPosition> initialPartitionEventPosition) Sets the map containing the event position to use for each partition if a checkpoint for the partition does not exist inCheckpointStore
. This map is keyed off of the partition id. If there is no checkpoint inCheckpointStore
and there is no entry in this map, the processing of the partition will start fromlatest
position.- Parameters:
initialPartitionEventPosition
- Map of initial event positions for partition ids.- Returns:
- The updated
EventProcessorClientBuilder
instance.
-
buildEventProcessorClient
This will create a newEventProcessorClient
configured with the options set in this builder. Each call to this method will return a new instance ofEventProcessorClient
.All partitions processed by this
EventProcessorClient
will start processing fromearliest
available event in the respective partitions.- Returns:
- A new instance of
EventProcessorClient
. - Throws:
NullPointerException
- ifprocessEvent
orprocessError
orcheckpointStore
orconsumerGroup
isnull
.IllegalArgumentException
- if the credentials have not been set using eitherconnectionString(String)
orcredential(String, String, TokenCredential)
. Or, if a proxy is specified but the transport type is notweb sockets
.
-
retryOptions(AmqpRetryOptions)
.