一个 JMS 主题是否可以有多个发布者?

发布于 2024-12-05 11:13:00 字数 122 浏览 0 评论 0原文

从我到目前为止所读到的内容来看,JMS 主题是一对多,我想知道是否可以使用主题支持多对多。考虑一个名为“报告”的主题,其中多个服务分布在需要发布计划报告的企业中。拥有多个发布者将减少为每个报告服务订阅感兴趣的应用程序的主题的需要。

From what I've read so-far, a JMS Topic is 1-to-Many and I wonder if its possible to support Many-to-Many using a topic. Consider a topic called "Reports" with multiple services spread out across an enterprise needing to publish scheduled reports. Having multiple publishers would alleviate the need to subscribe interested applications to a topic for each of the reporting services.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心是晴朗的。 2024-12-12 11:13:00

@Mondain:是的,很有可能。一个实际的例子是由多个来源提供的实时股票市场价格反馈以及由多个渠道消耗的反馈。

@Mondain: yes, very much possible. A practical example would be live stock market price feed provided by multiple sources and those feed consumed by multiple channels.

晌融 2024-12-12 11:13:00

是的,您可以从 TopicSession 创建多个 TopicPublisher,并且许多应用程序可以使用 TopicPublisher 连接同一个 Topic主题订阅者

Yes, you can create many TopicPublisher from your TopicSession, and many applications can connect the same Topic using TopicPublisher or TopicSubscriber.

我恋#小黄人 2024-12-12 11:13:00

您可以执行类似的操作,并调用 CreateMessageProducer 在应用程序中的任何位置创建生产者的新实例。

  public ActiveMqProducer(string activeMqServiceUrl)
  {  
        _activeMqServiceUrl = activeMqServiceUrl; 

        IConnectionFactory factory = new ConnectionFactory(new Uri(_activeMqServiceUrl));

        _activeMqConnection = factory.CreateConnection();

        _activeMqSession = _activeMqConnection.CreateSession(AcknowledgementMode.Transactional);

        _activeMqConnection.Start();
  }

  private IMessageProducer CreateMessageProducer(string mqTopicName)
  {
        ITopic destination = SessionUtil.GetTopic(_activeMqSession, mqTopicName);
        var producer = _activeMqSession.CreateProducer(destination);
        return producer;
  }

You can do something like this, and call CreateMessageProducer to create a new instance of producer anywhere in your application.

  public ActiveMqProducer(string activeMqServiceUrl)
  {  
        _activeMqServiceUrl = activeMqServiceUrl; 

        IConnectionFactory factory = new ConnectionFactory(new Uri(_activeMqServiceUrl));

        _activeMqConnection = factory.CreateConnection();

        _activeMqSession = _activeMqConnection.CreateSession(AcknowledgementMode.Transactional);

        _activeMqConnection.Start();
  }

  private IMessageProducer CreateMessageProducer(string mqTopicName)
  {
        ITopic destination = SessionUtil.GetTopic(_activeMqSession, mqTopicName);
        var producer = _activeMqSession.CreateProducer(destination);
        return producer;
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文