选择哪种Azure消息传递服务以不同的消息发布给不同的订阅者? [英] Which Azure messaging service to choose to publish with different messages to different subscribers?

查看:100
本文介绍了选择哪种Azure消息传递服务以不同的消息发布给不同的订阅者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自

From last question about Azure messaging service by publishing one common message to multiply subscribers by using service bus topic. But we've encounter an issue that our message size is over-sized of the service buss limitation(256KB), so we changed our design by splitting the GIANT message into small piece of sub-message and send them to different subscribers, here is what I'd like to achieve:

假设我们将订单对象保存在名为 SaveOrder 的azure函数中,成功保存订单后,我们想向3个订阅者/消费者发送不同的消息(内容),即还使用天蓝色函数实现/触发

Let's say we are saving an order object in azure function called SaveOrder and after order was saved successfully, we would like to send different messages(content) to 3 subscribers/consumers which is also implemented/triggered with azure functions,

订户/天蓝色功能1 将用于报告-带有消息1 ,例如

{
 'reportHeader':'Order Report for ID 012913',
 'report_notes':'A few additional report notes...'
}

订户/天蓝色功能2 将用于日志记录(Sql Server)-带有消息2 ,例如

subscriber/azure function 2 would be using for logging(Sql Server) - with message 2, e.g

{
  'logAction':'Order Saved Successfully', 
  'logTime':'08/12/2019 12:38:12 AM',
  'logDescription': 'Order Id - 0139281',
  'log_notes':'A few additional log notes...'
}

订户/天蓝色功能3 将用于持续的业务逻辑. -带有消息3 ,例如

subscriber/azure function 3 would be using for continuing business logic. - with message 3, e.g

{
  'action':'Prepare product accumulation',
  'ProductList': {
    '813891':3
    '581231':1
  },
  'accumulation_notes':'A few additional accumulation notes...'
}

所有上述 azure函数订阅者将独立工作/隔离,并且我们的azure函数 SaveOrder 不必等待这三个函数中的任何一个,它应该消息发布后退出或终止.

All of above azure functions subscriber will be working independently/isolated, and our azure function SaveOrder doesn't have to wait for any of these 3 functions, it should exit or terminate once the message publishes.

在这种情况下,我应该在Azure中选择哪种消息传递服务来处理该消息传递服务?服务巴士在这里还能继续工作吗?据我了解,服务总线主题将发送/发布相同/一个"消息内容,以使订户增加.

In this case, which of the messaging service should I choose in Azure for handling that? Would service bus still work here? As my understanding is that Service bus topic would send/publish "same/one" message content to multiply subscribers.

推荐答案

如果message1始终仅转到function1message2仅转到function2,依此类推,则创建3条服务总线队列就足够了.这只是将消息从发送方传输到接收方(函数)(FIFO样式).

If message1 always only goes to function1, message2 only to function2, and so on, creating 3 Service Bus Queues would suffice. This simply transports the message from a sender to a receiver (function) (FIFO-style).

SaveOrder发送message1queue1,将message2发送到queue2等.

From SaveOrder, you'd send message1 to queue1, message2 to queue2 etc.

  • function1queue1接收消息.
  • function2queue2接收消息.
  • function3接收来自queue3的消息.
  • function1 receives messages from queue1.
  • function2 receives messages from queue2.
  • function3 receives messages from queue3.

使用

Using topics and subscriptions will also work, by creating 3 topics with 1 subscription each:

SaveOrder发送message1topic1,将message2发送到topic2等.

From SaveOrder, you'd send message1 to topic1, message2 to topic2 etc.

  • function1subscription1接收消息.
  • function2接收来自subscription2的消息.
  • function3接收来自subscription3的消息.
  • function1 receives messages from subscription1.
  • function2 receives messages from subscription2.
  • function3 receives messages from subscription3.

第二种情况更加灵活,因为它允许通过向同一主题添加更多订阅来允许同一(复制)消息的多个接收者.

The second scenario is more flexible, as it allows multiple receivers of the same (copy) message, by adding more subscriptions to the same topic.

此外,您可以gzip邮件的有效负载以提高传输效率.

Also, you can gzip the payloads of your messages to make transport more efficient.

这篇关于选择哪种Azure消息传递服务以不同的消息发布给不同的订阅者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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