static CompletableFuture<PartitionReceiver> create(MessagingFactory factory,
final String eventHubName,
final String consumerGroupName,
final String partitionId,
final EventPosition eventPosition,
final long epoch,
final boolean isEpochReceiver,
ReceiverOptions receiverOptions,
final ScheduledExecutorService executor) {
if (epoch < NULL_EPOCH) {
throw new IllegalArgumentException("epoch cannot be a negative value. Please specify a zero or positive long value.");
}
if (StringUtil.isNullOrWhiteSpace(consumerGroupName)) {
throw new IllegalArgumentException("specify valid string for argument - 'consumerGroupName'");
}
if (receiverOptions == null) {
receiverOptions = new ReceiverOptions();
}
final PartitionReceiverImpl receiver = new PartitionReceiverImpl(factory, eventHubName, consumerGroupName, partitionId, (EventPositionImpl) eventPosition, epoch, isEpochReceiver, receiverOptions, executor);
return receiver.createInternalReceiver().thenApplyAsync(new Function<Void, PartitionReceiver>() {
public PartitionReceiver apply(Void a) {
return receiver;
}
}, executor);
}