Microsoft Azure Service Bus/Event Hub: No messages, only requests

邮差的信 提交于 2020-05-14 12:34:49

问题


I'm sending messages through HTTP POST to my Azure Event Hub (to use with IoT Hub and a Blob storage).

These are the HTTP call's settings:

Every time I send a message, I get a request, but no message.

I've tried:

  • different SAS keys and owners
  • different headers as well as no headers

I've added the headers after finding this question. I also made sure to check the permissions, as it was suggested there, but they were already set to the necessary level.

Noteworthy: for some reason, it did work once with the original settings (marked in yellow on the first image).

My questions:
1. Do I need to manually add a service bus endpoint with the same name? I'm assuming when you create an event hub, it automatically creates the service bus for you.
2. Could it be the requests I'm seeing actually have nothing to do with the messages I'm sending?
3. Am I configuring this wrong?


回答1:


After doing some more research and trying out different methods, this seems to be the one that works for me:

As an endpoint, you need to use

https://{servicebus-name}.servicebus.windows.net/{eventhub-name}/messages

instead of just

https://{servicebus-name}.servicebus.windows.net/

The content-type and content-encoding headers seem to be necessary as well as another header:

host: {servicebus-name}.servicebus.windows.net;

In the Microsoft Docs they add slightly different headers and use a different URL, but that doesn't work for me. This does.

To answer my own questions in case it can help someone in the future:

  1. Do I need to manually add a service bus endpoint with the same name? I'm assuming when you create an event hub, it automatically creates the service bus for you.

You don't need to manually add a service bus, however you can not configure the service bus that has automatically been created for you. SharedAccessAuthorizationRules can only be applied on namespaces and their children, applying these directly to a service bus is currently not supported.

  1. Could it be the requests I'm seeing actually have nothing to do with the messages I'm sending?

Not all requests are messages, which is normal, but after monitoring activity it did point out that the requests I was receiving were directly related to my devices sending messages.

  1. Am I configuring this wrong?

Yes.



来源:https://stackoverflow.com/questions/52717891/microsoft-azure-service-bus-event-hub-no-messages-only-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!