Source:
public synchronized void start() { isStarted = true; for (Map.Entry<SystemStreamPartition, String> entry : streamPartitionStartingOffsets.entrySet()) { SystemStreamPartition ssp = entry.getKey(); String streamName = ssp.getStream(); Integer partitionId = ssp.getPartition().getPartitionId(); String offset = entry.getValue(); String consumerGroup = config.getStreamConsumerGroup(streamName); String namespace = config.getStreamNamespace(streamName); String entityPath = config.getStreamEntityPath(streamName); EventHubClientWrapper ehClientWrapper = streamEventHubClients.get(streamName); try { PartitionReceiver receiver; if (StringUtil.isNullOrWhiteSpace(offset)) { throw new SamzaException( String.format("Invalid offset %s system=%s, stream=%s", offset, namespace, entityPath)); } if (offset.equals(EventHubSystemConsumer.END_OF_STREAM)) { receiver = ehClientWrapper.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), Instant.now()); } else { receiver = ehClientWrapper.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), offset, !offset.equals(EventHubSystemConsumer.START_OF_STREAM)); } PartitionReceiveHandler handler = new PartitionReceiverHandlerImpl(ssp, eventReadRates.get(streamName), eventByteReadRates.get(streamName), readLatencies.get(streamName), readErrors.get(streamName), serdes.getOrDefault(streamName, null)); streamPartitionHandlers.put(ssp, handler); receiver.setReceiveHandler(handler); streamPartitionReceivers.put(ssp, receiver); } catch (Exception e) { throw new SamzaException( String.format("Failed to create receiver for EventHubs: namespace=%s, entity=%s, partitionId=%d", namespace, entityPath, partitionId), e); } LOG.info(String.format("Connection successfully started for namespace=%s, entity=%s ", namespace, entityPath)); } }

Target:
public void start() { isStarted = true; for (Map.Entry<SystemStreamPartition, String> entry : streamPartitionOffsets.entrySet()) { SystemStreamPartition ssp = entry.getKey(); String streamName = ssp.getStream(); Integer partitionId = ssp.getPartition().getPartitionId(); String offset = entry.getValue(); String consumerGroup = config.getStreamConsumerGroup(systemName, streamName); String namespace = config.getStreamNamespace(systemName, streamName); String entityPath = config.getStreamEntityPath(systemName, streamName); EventHubClientManager eventHubClientManager = streamEventHubManagers.get(streamName); try { PartitionReceiver receiver; if (offset.equals(EventHubSystemConsumer.END_OF_STREAM)) { receiver = eventHubClientManager.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), Instant.now()); } else { receiver = eventHubClientManager.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), offset, !offset.equals(EventHubSystemConsumer.START_OF_STREAM)); } PartitionReceiveHandler handler = new PartitionReceiverHandlerImpl(ssp, eventReadRates.get(streamName), eventByteReadRates.get(streamName), readLatencies.get(streamName), readErrors.get(streamName), interceptors.getOrDefault(streamName, null)); receiver.setReceiveTimeout(DEFAULT_EVENTHUB_RECEIVER_TIMEOUT); receiver.setReceiveHandler(handler); streamPartitionHandlers.put(ssp, handler); streamPartitionReceivers.put(ssp, receiver); } catch (Exception e) { throw new SamzaException( String.format("Failed to create receiver for EventHubs: namespace=%s, entity=%s, partitionId=%d", namespace, entityPath, partitionId), e); } LOG.debug(String.format("Connection successfully started for namespace=%s, entity=%s ", namespace, entityPath)); } }