Source:
<code>public void startPartitionPump(PartitionOwnership claimedOwnership) { if (partitionPumps.containsKey(claimedOwnership.getPartitionId())) { logger.info("Consumer is already running for this partition {}", claimedOwnership.getPartitionId()); return; } PartitionContext partitionContext = new PartitionContext(claimedOwnership.getPartitionId(), claimedOwnership.getEventHubName(), claimedOwnership.getConsumerGroupName(), claimedOwnership.getOwnerId(), claimedOwnership.getETag(), partitionManager); PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); partitionProcessor.initialize(partitionContext); EventPosition startFromEventPosition; if (claimedOwnership.getOffset() != null) { startFromEventPosition = EventPosition.fromOffset(claimedOwnership.getOffset()); } else if (claimedOwnership.getSequenceNumber() != null) { startFromEventPosition = EventPosition.fromSequenceNumber(claimedOwnership.getSequenceNumber()); } else { startFromEventPosition = initialEventPosition; } EventHubConsumerOptions eventHubConsumerOptions = new EventHubConsumerOptions().setOwnerLevel(0L); EventHubAsyncConsumer eventHubConsumer = eventHubAsyncClient .createConsumer(claimedOwnership.getConsumerGroupName(), claimedOwnership.getPartitionId(), startFromEventPosition, eventHubConsumerOptions); partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); eventHubConsumer.receive().subscribe(eventData -> { try { Context processSpanContext = startProcessTracingSpan(eventData); <START> if (processSpanContext.getData("span-context").isPresent()) { <END> eventData.addContext("span-context", processSpanContext); } partitionProcessor.processEvent(partitionContext, eventData).doOnEach(signal -> endProcessTracingSpan(processSpanContext, signal)).subscribe(unused -> { }, ex -> handleProcessingError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext)); } catch (Exception ex) { handleProcessingError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext); } }, ex -> handleReceiveError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), () -> partitionProcessor.close(partitionContext, CloseReason.EVENT_PROCESSOR_SHUTDOWN)); }</code><technical_language>a shared constants class in event hubs redefine shared strings. is a ClientConstants class</technical_language>

Target:
public void startPartitionPump(PartitionOwnership claimedOwnership) { if (partitionPumps.containsKey(claimedOwnership.getPartitionId())) { logger.info("Consumer is already running for this partition {}", claimedOwnership.getPartitionId()); return; } PartitionContext partitionContext = new PartitionContext(claimedOwnership.getPartitionId(), claimedOwnership.getEventHubName(), claimedOwnership.getConsumerGroupName(), claimedOwnership.getOwnerId(), claimedOwnership.getETag(), partitionManager); PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); partitionProcessor.initialize(partitionContext); EventPosition startFromEventPosition; if (claimedOwnership.getOffset() != null) { startFromEventPosition = EventPosition.fromOffset(claimedOwnership.getOffset()); } else if (claimedOwnership.getSequenceNumber() != null) { startFromEventPosition = EventPosition.fromSequenceNumber(claimedOwnership.getSequenceNumber()); } else { startFromEventPosition = initialEventPosition; } EventHubConsumerOptions eventHubConsumerOptions = new EventHubConsumerOptions().setOwnerLevel(0L); EventHubAsyncConsumer eventHubConsumer = eventHubAsyncClient .createConsumer(claimedOwnership.getConsumerGroupName(), claimedOwnership.getPartitionId(), startFromEventPosition, eventHubConsumerOptions); partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); eventHubConsumer.receive().subscribe(eventData -> { try { Context processSpanContext = startProcessTracingSpan(eventData); if (processSpanContext.getData(SPAN_CONTEXT_KEY).isPresent()) { eventData.addContext(SPAN_CONTEXT_KEY, processSpanContext); } partitionProcessor.processEvent(partitionContext, eventData).doOnEach(signal -> endProcessTracingSpan(processSpanContext, signal)).subscribe(unused -> { }, ex -> handleProcessingError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext)); } catch (Exception ex) { handleProcessingError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext); } }, ex -> handleReceiveError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), () -> partitionProcessor.close(partitionContext, CloseReason.EVENT_PROCESSOR_SHUTDOWN)); }