使用Service Bus发送和接收消息 [英] Using Service Bus to both send and receive messages

查看:401
本文介绍了使用Service Bus发送和接收消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想知道是否可以在应用程序中使用Azure Service Bus,它既可以发送消息,也可以从主题接收消息。

I would like to know if it is possible to use Azure Service Bus inside an app that both sends and receives messages from and to topics.

这里的问题是此应用程序应该在订阅时收听,并且
并行,将消息发送到其他主题。

The issue here is that this application should be listening on a subscription and, in parallel, send messages to other topics.

此外,向其他主题发送消息取决于在应用正在侦听的订阅中收到的消息。例如:如果我收到消息"A",在订阅上,我想向主题"A"发送消息,
但是如果我收到消息"B",我想向主题"B"发送消息。发送消息后,收听不应该停止,因为新消息可能会到达。

Furthermore, sending messages to other topics depends on the messages received in the subscription the app is listening on. For example: if I receive the message "A" on the subscription, I want to send a message to topic "A", but if I receive the message "B", I want to send a message to topic "B". The listening should not stop after sending messages, as new messages may arrive.

是否可以使用服务总线解决此任务? 

Is it possible to address this task using Service Bus? 

提前谢谢。

推荐答案

是的。这确实是可能的。

Yes. This is indeed possible.

事实上,你甚至不需要有一个应用程序来执行此操作,而只需使用

autoforwarding
服务总线功能。

In fact, you don't even need to have an application that does this and instead just use the autoforwarding feature of Service Bus.

只需使用
主题相应地过滤
并将它们的ForwardTo属性设置为您希望它们转发到的相应主题。

Just create separate subscriptions for messages of type A and type B with topic filters accordingly and set the ForwardTo property on them to the corresponding topics you want them to forward to.


这篇关于使用Service Bus发送和接收消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆