sending events to eventhub fails every early morning with the below message. I have masked the number, since I am not sure what is that number and for security reasons.(code and error below)
- I consistently send ~240 events per minute of very small size, so that should not be the problem.
- I have 2 partitions and 2 consumers for my eventhub Please let me know if any of you know the solution or need more info. Thanks!
Error: Message :An error occurred during communication with 'XXXXX06f186e4bb89aea2d8959bXXXXX_GXX'. Check the connection information, then retry.
StackTrace : at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult1.End(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.Amqp.FaultTolerantObject1.OnEndCreateInstance(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.SingletonManager1.EndGetInstance(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.Amqp.AmqpMessageSender.OnEndOpen(IAsyncResult result) at Microsoft.ServiceBus.Messaging.ClientEntity.EndOpen(IAsyncResult result) at Microsoft.ServiceBus.Messaging.OpenOnceManager.OnEndCreateInstance(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.SingletonManager1.EndGetInstance(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.OpenOnceManager.OpenOnceManagerAsyncResult1.OpenComplete(IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult.SyncContinue(IAsyncResult result) at Microsoft.ServiceBus.Messaging.OpenOnceManager.OpenOnceManagerAsyncResult1..ctor(OpenOnceManager openOnceManager, TimeSpan openTimeout, AsyncCallback callback, Object state, Func3 beginOperation, EndOperation1 endOperation) at Microsoft.ServiceBus.Messaging.OpenOnceManager.Begin(AsyncCallback callback, Object state, Func3 beginOperation, Action1 endOperation) at Microsoft.ServiceBus.Messaging.MessageSender.BeginSendEventData(TrackingContext trackingContext, IEnumerable1 eventDatas, TimeSpan timeout, AsyncCallback callback, Object state) at Microsoft.ServiceBus.Messaging.EventHubSender.<>c__DisplayClass23_0.b__0(AsyncCallback c, Object s) at System.Threading.Tasks.TaskFactory1.FromAsyncImpl(Func3 beginMethod, Func2 endFunction, Action1 endAction, Object state, TaskCreationOptions creationOptions) at Microsoft.ServiceBus.Common.Parallel.TaskHelpers.CreateTask(Func3 begin, Action`1 end, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() Date :4/12/2017 2:48:17 AM
Code: EventHubClient deveventHubClient = EventHubClient.CreateFromConnectionString(connectionString, "EventHubName");
private async Task SendInBatch(IList<byte[]> source, Guid UUID)
{
List events = new List(source.Select(b => new EventData(b)));
EventHubSender Partition0;
EventHubSender Partition1;
Partition0 = deveventHubClient.CreatePartitionedSender("0");
Partition1 = deveventHubClient.CreatePartitionedSender("1");
if (UUID.GetHashCode() % 2 == 0)
{
await Partition0.SendBatchAsync(events);
}
else
{
await Partition1.SendBatchAsync(events);
}
return Unit.Default;
}