【问题标题】:How to send JMS message with header & payload from .NET?如何从 .NET 发送带有标头和有效负载的 JMS 消息?
【发布时间】:2013-12-07 22:26:39
【问题描述】:

我有一个要求,我需要从 .NET 端向 ACTIVEMQ 发送一些消息。我发送的是这样的:

string destination="queue.name";
Hashtable message = new Hashtable();
message.Add("id", id);
message.Add("companyid", 12435);
message.Add("message", "Hello World");
Apache.NMS.ActiveMQ.ConnectionFactory connectionFactory = new ConnectionFactory(URI);
Spring.Messaging.Nms.Core.NmsTemplate template = new Spring.Messaging.Nms.Core.NmsTemplate(connectionFactory);
template.ConvertAndSend(destination, message);

这就是我们正在做的。但是现在侦听器期望“id”和“companyid”出现在标头上,“message”出现在有效载荷上。

如何将它从 .NET 发送到 ActiveMQ?任何帮助将不胜感激。

问候, 尼米

【问题讨论】:

    标签: asp.net .net apache activemq


    【解决方案1】:

    不熟悉 Spring.NET 的东西,但从外观上看,这应该是向 ActiveMQ 发送 IMapMessage 类型的消息。如果您希望消息标头中的各个位比我认为您需要使用一种方法来允许您发布处理消息并将所需的值移动到标头中,或者使用不同的 API 以便您可以创建不同的消息类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      相关资源
      最近更新 更多