Why does NServiceBus on Azure not use my specified endpoint name?

*爱你&永不变心* 提交于 2019-12-13 04:34:59

问题


I have a console app that uses NServiceBus to publish a message to an Azure topic. However, NServiceBus creates a new topic with a different name, instead of the one I specified. Why is this?

More details

My message configuration looks as follows. This means that messages of Type 'TheResponse' should go to a Topic with the name, "test1", right?

<UnicastBusConfig>
    <MessageEndpointMappings>

        <add Assembly="Messages" Type="Messages.TheResponse" Endpoint="test1"/>

    </MessageEndpointMappings>
</UnicastBusConfig>

<connectionStrings>
    <add name="NServiceBus/Transport"
        connectionString="Endpoint=sb://[my-namespace].servicebus.windows.net/;SharedSecretIssuer=[issuer];SharedSecretValue=[key]"></add>
</connectionStrings>

What happens in reality is that NServiceBus creates a new Topic on Azure in the format MyAssemblyName-MyMachineName.events.

We use the Azure Service Bus transport.

How do I get NServiceBus to publish events to a specific Topic? Do I misunderstand the purpose of the MessageEndpointMappings?


回答1:


Azure servicebus does not allow to name multiple entities of different types with the same name, so each endpoint defines an input queue named after the endpoint name and a publishing topic with '.events' appended.

You cannot publish to a specific topic, an endpoint can only publish on it's own topic and subscribers can decide to listen to specific endpoints.

Your mapping file actually says, all messages/commands of type Messages.TheResponse should be sent to the input queue of endpoint 'test1', or in case that TheResponse would be an event: please subscribe to the publishing topic of endpoint 'test1'



来源:https://stackoverflow.com/questions/30750322/why-does-nservicebus-on-azure-not-use-my-specified-endpoint-name

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