ServiceStack Messaging API:它可以进行广播吗? [英] ServiceStack Messaging API: Can it make a broadcast?

查看:66
本文介绍了ServiceStack Messaging API:它可以进行广播吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我以前 提到,我正在使用ServiceStack Messaging API (IMessageQueueClient.Publish) 以及更底层的 IRedisClient.PublishMessage.

As I have previously mentioned, I am using ServiceStack Messaging API (IMessageQueueClient.Publish) as well as the more low-level IRedisClient.PublishMessage.

当我需要一个特定的消息/请求仅由一个模块/服务的一个实例处理时,我会使用 Messaging API,因此即使我可能有多个模块在运行,所有模块都在侦听 MyRequest,只有一个服务接收消息并进行处理.

I use the Messaging API when I need a specific message/request to be processed by only one instance of a module/service, so even though I might have several modules running that all listens for MyRequest, only one service receives the message and processes it.

我在进行广播、发布/订阅情况时使用 IRedisClient.PublishMessage,发送每个人都应该接收的请求,该请求在该特定 Redis 频道上进行侦听.

I use the IRedisClient.PublishMessage when I do a broadcast, a pub/sub situation, sending a request that everyone should receive that listens on that specific Redis channel.

但是,在我的情况下,使用 Messaging API 会很有用,但要进行广播,以便所有正在侦听特定消息类型的实例获取消息,不只是一个.

However, I am in a situation where it would be useful to use the Messaging API, but do a broadcast, so that all instances that are listening to a specific message type, gets the message, not just the one.

(这样做的原因是为了简化我们对 Redis 的使用以及我们如何订阅事件/请求,但我现在不会详细介绍这一点.有关此的更多背景信息是 此处.)

(The reason for this is to streamline our usage of Redis and how we subscribe to events/request, but I will not get into details about this now. A little more background on this is here.)

有没有广播方式"?用于消息 API?

Is there a "broadcast way" for the Messaging API?

推荐答案

不,ServiceStack Messaging的目的 只是通过 MQ 调用 ServiceStack 服务.任何其他 MQ 功能都超出了目的 &ServiceStack MQ 的范围,您需要直接针对 MQ 提供程序 API 进行开发以访问其广播功能.

No, the purpose of ServiceStack Messaging is simply to invoke ServiceStack Services via MQ. Any other MQ features is outside the purpose & scope of ServiceStack MQ, you'd need to instead develop against the MQ Provider APIs directly to access their broadcast features.

服务器事件 是一项 ServiceStack 功能,支持向用户定义频道的订阅者广播消息,但它是一个完全不同的实现,它服务于发送服务器推送"的不同用例.HTTP 或 gRPC 上的实时事件,例如它不使用 MQ 代理,并且发布/订阅消息不是持久的(即只有在发送消息时订阅者才会收到它们).

Server Events is a ServiceStack feature that supports broadcasting messages to subscribers of user-defined channels, but its a completely different implementation that serves a different use-case for sending "server push" real-time events over HTTP or gRPC, e.g. it doesn't use MQ brokers and pub/sub messages aren't persistent (i.e. only subscribers at time messages are sent will receive them).

这篇关于ServiceStack Messaging API:它可以进行广播吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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