5

I have started work with EventHub recently and meet the problem: code of message producing executes without any exception, however message wasn't published to EventHub.

I'm verifying that message wasn't published via simple consumer in console application and via letters from our client (which owns EventHub account and has access to it's portal with metrics). Code of producer/consumer was taken from https://learn.microsoft.com/en-us/azure/event-hubs/get-started-dotnet-standard-send-v2.

Producer Code :

            var ConnectionString = "Endpoint=sb://{EventHub Namespace}.servicebus.windows.net/;SharedAccessKeyName={KeyName};SharedAccessKey={Key};EntityPath={EventHub Instance}"
            await using (var producerClient = new EventHubProducerClient(ConnectionString))
            {
                var batch = await producerClient.CreateBatchAsync();
                batch.TryAdd(new EventData(Encoding.UTF8.GetBytes("test1 message")));
                await producerClient.SendAsync(batch);
            }
            

When I use same code with connection string to my private Eventhub, I'm able to send/receive messages in EventHub.

What could be the reason for EventHub client to execute producing message code without succesfully delivery of message?

Additional information:

Request to https://{EventHub Namespace}.servicebus.windows.net returns succesfull response.

".\psping.exe -n 25 -i 1 -q {EventHub Namespace}.servicebus.windows.net:5671 -nobanner" shows 0% loss

WhiteRom
  • 73
  • 6
  • 2
    SendAsync not throwing means event is successfully sent. Make sure you are sending and receiving on the same eventhub. Are you seeing anything in the metrics dashboard? – Serkant Karaca Jul 30 '20 at 21:07
  • Make sure you are sending and receiving on the same eventhub - checked one more time, connection strings are the same. Are you seeing anything in the metrics dashboard? - unfortunately I don't have access to our client's azure portal account. – WhiteRom Jul 30 '20 at 21:20
  • I concur with Serkant. The code looks correct to me; creating the batch establishes a connection to the Event Hubs service, so we've got a confirmed service operation. At the end of the await of the task returned by SendAsync, if no error was thrown then the client received an acknowledgement from the service that the send operation completed successfully. Would you be willing to share the code that you're using to read the event back? – Jesse Squire Jul 31 '20 at 14:14

0 Answers0