Search code examples
azureazure-blob-storageazure-storageazure-eventhubazure-storage-account

Why Azure event hub subscriber not working?


I am implementing an azure event hub subscriber which is successfully able to connect but it's not receiving the message for a particular event hub in an event hub namespace. But it's working as expected for the other event hub in the same namespace. there is no error in the logs. Is there any way to find out the root cause of the issue?

I am successfully able to publish the message with the same configuration.

Publisher and Subscriber are running on the same machine.

I have implemented the publisher and subscriber in Dapr.

Both publisher and subscriber logs are exactly the same in Dapr, So I think it's an issue with the storage account.

Adding more information:

I have tried my application with a different storage account and it's working as expected. So what is the issue? How can I resolve it? I want to work with my old storage account.


Solution

  • All issues

    There are multiple problems put together in your question, which can be tested separately. (E.g. event hubs, dapr, storage account ...etc.) It is critical to have a granular understanding of these problems, so I would try to test them one-by-one.

    Event Hub issues

    You can test your Event Hub flow separately by creating simple "hello world" clients locally and reproducing a relationship between them based on your production scenario.

    E.g.

    • try to connect to an event hub with exactly one publisher and exactly one consumer,
    • try to publish the same message with one publisher to multiple event hubs and see if you can consume them with separate consumers,
    • ...etc.

    Based on your comment, I will list 2 example problem scenarios:

    Problem 1: "I can access one Event Hub in the namespace, but can't access another in the same namespace."

    • You can configure "Shared Access Policies" for the scope of the Event Hub Namespace, which will be applied to all event hubs in that namespace.
    • You can also configure the same policies for the scope of the Event Hub, which will be applied to that single hub only.

    Make sure to use the appropriate scope in Azure portal while trying to use the connection strings from your code.

    Problem 2: "I can publish messages from a client to an Event Hub, but cannot consume messages with the same client, from the same machine, with the same connection string."

    You can configure an infinite number of "Shared Access Policies", each having a custom key and connection string.

    You can also configure client access privileges for each policy, chosen from the following 3 options:

    • Manage
    • Send
    • Listen

    Make sure to use the appropriate client access privileges. If you want to use the same exact connection string for sending and listening, add both "Send" and "Listen" access to that policy. (You can also have a different policy and connection string for sending and listening...etc.)