public IEventHubReceiver CreateEventHubReceiver(EventHubsConnectionStringBuilder connectionStringBuilder, string consumerGroupName = null, EventPosition eventPosition = null, ReceiverOptions receiverOptions = null) { if (connectionStringBuilder == null) { throw new ArgumentNullException(nameof(connectionStringBuilder), "To create an event hub receiver the connection string builder cannot be null"); } if (string.IsNullOrWhiteSpace(consumerGroupName)) { throw new ArgumentException("To create an event hub receiver the consumer group name cannot be null or empty", nameof(consumerGroupName)); } var receiver = new EventHubReceiver(connectionStringBuilder); receiver.CreateReceivers(eventPosition ?? EventPosition.FromStart(), consumerGroupName, receiverOptions).GetAwaiter().GetResult(); return(receiver); }