async Task CreateNewPumpAsync(string partitionId, Lease lease) { PartitionPump newPartitionPump = new EventHubPartitionPump(this.host, lease); await newPartitionPump.OpenAsync().ConfigureAwait(false); this.partitionPumps.TryAdd(partitionId, newPartitionPump); // do the put after start, if the start fails then put doesn't happen ProcessorEventSource.Log.PartitionPumpInfo(this.host.Id, partitionId, "Created new PartitionPump"); }
async Task CreateNewPumpAsync(string partitionId) { // Refresh lease content and do last minute check to reduce partition moves. var refreshedLease = await this.host.LeaseManager.GetLeaseAsync(partitionId).ConfigureAwait(false); if (refreshedLease.Owner != this.host.HostName || await refreshedLease.IsExpired().ConfigureAwait(false)) { // Partition moved to some other node after lease acquisition. // Return w/o creating the pump. ProcessorEventSource.Log.PartitionPumpInfo(this.host.HostName, partitionId, $"Partition moved to another host or expired after acquisition."); return; } PartitionPump newPartitionPump = new EventHubPartitionPump(this.host, refreshedLease); await newPartitionPump.OpenAsync().ConfigureAwait(false); this.partitionPumps.TryAdd(partitionId, newPartitionPump); // do the put after start, if the start fails then put doesn't happen ProcessorEventSource.Log.PartitionPumpInfo(this.host.HostName, partitionId, "Created new PartitionPump"); }
public PartitionReceiveHandler(EventHubPartitionPump eventHubPartitionPump) { this.eventHubPartitionPump = eventHubPartitionPump; this.MaxBatchSize = eventHubPartitionPump.Host.EventProcessorOptions.MaxBatchSize; }