Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Service Bus - How can I publish messages to multiple topics #1064

Closed
BBanoth opened this issue Jan 5, 2022 · 7 comments
Closed

Azure Service Bus - How can I publish messages to multiple topics #1064

BBanoth opened this issue Jan 5, 2022 · 7 comments

Comments

@BBanoth
Copy link

BBanoth commented Jan 5, 2022

Hi

I am using Azure Service Bus as Transport.
As far I understand, can publish to only single topic from one application.

Publishing to multiple topics is possible with CAP ?

@yang-xiaodong
Copy link
Member

An event is commonly published to a single topic and doesn’t need to be published to two. When a need is to fan out that event, , you could set up a subscription on the topic used group name.

Could you elaborate on what you are trying to achieve and how publishing to multiple topics would help your case?

@yang-xiaodong
Copy link
Member

No response, closed!

@jonekdahl
Copy link
Contributor

I have a use case where some business processes publish events on topic A and others on topic B (so not in the same transaction). Is that supported?

@yang-xiaodong
Copy link
Member

@jonekdahl
I don't quite understand what you mean, it doesn't seem very relevant to this topic, can you open a new issue to describe it?

@jonekdahl
Copy link
Contributor

jonekdahl commented Jan 14, 2022

@yang-xiaodong Like the OP, I would like to know if it is possible to publish to multiple topics.

An event is commonly published to a single topic and doesn’t need to be published to two.

For a single event, I would agree. However, my use case is that one type of event needs to be published to topic A, while another type of event needs be published to topic B. So I'm not looking for a way to fan out a single event to multiple subscribers, but some way to tell CAP how to route message in each case.

AFAICT, this would require setting up multiple instances of CAP with a separate database schema for each instance, which seems doable but not very convenient.

@yang-xiaodong
Copy link
Member

yang-xiaodong commented Jan 17, 2022

@jonekdahl The message name is the Topic, So you can publish twice.

_cap.Publish("Topic A", one type);
_cap.Publish("Topic B", another type);

But I don't think you mean that, If you mean send the message to a different database or broker in one service, we currently do not provide direct support for publish one message to different database or broker, but there is a way to achieve it, you can check this comment to get details
#998 (comment)

@jonekdahl
Copy link
Contributor

@yang-xiaodong The name parameter of the Publish method is described as "the topic name or exchange router key" but using different names doesn't actually cause messages to be published to different Service Bus topics. The Service Bus transport only uses the name as the message label, using the configured TopicPath for all messages.

I think #1074 is asking for the same thing and it looks like it has a draft PR that introduces a new message header to allow overriding the topic path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants