.Net 消息传递和STOMP协议

发布于 2024-09-16 04:46:34 字数 128 浏览 4 评论 0原文

我对 .net 消息传递和 .net 消息传递有疑问它与其他开放协议的兼容性。我想知道.net 消息传递 API 是否能够与 STOMP 协议一起使用?我如何使用这个协议?有没有我需要使用的特定库?

感谢您分享您的经验和想法。

I have a doubt regarding .net messaging & its compatibility with other open protocols out there. I would like to know if .net messaging API capable of working with STOMP protocol? How do i make use of this protocol? is there any specific library out there I need to use?

thanks for sharing your experience and ideas.

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

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

发布评论

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

评论(2

依 靠 2024-09-23 04:46:34

如果您的目标是从 .NET 语言发送消息,请考虑利用适用于 .NET 的 Apache ActiveMQ NMS 库。他们声称使用单个 API 连接到多个不同的提供商。

目前,可以使用以下提供程序:

  • ActiveMQ,它使用 OpenWire 连接到 ActiveMQ 消息代理。
  • STOMP 连接到任何 STOMP 代理。

上面链接的他们的网站提供了下载内容,以及有关如何开始常见消息传递场景的文章的链接。

If your goal is to send messages from a .NET language, consider leveraging the Apache ActiveMQ NMS library for .NET. They claim to use a single API to connect to multiple different providers.

Currently, the following providers are available:

  • ActiveMQ which connects using OpenWire to an ActiveMQ Message Broker.
  • STOMP which connects to any STOMP Broker.

Their site linked above has the downloads, and links to articles on how to get started on the common messaging scenarios.

肤浅与狂妄 2024-09-23 04:46:34

从根本上来说,STOMP 似乎是基于 TCP 的消息传递及其命令和控制字符集。

.NET 中没有任何内容会让您怀疑无法使用此协议构建应用程序或库。如果您从头开始构建 .NET STOMP 库,则必须利用 System.Net.Sockets。下面是一些示例 C# 代码。

Byte[] bytesSent = Encoding.ASCII.GetBytes(someStringMessage);

// Create a socket connection with the specified server and port.
Socket s = ConnectSocket("192.168.0.101", somePort);

// If the socket could not get a connection, then return false.
if (s == null)
    return false;

// Send message to the destination.
s.Send(bytesSent, bytesSent.Length, 0);

// Receive the response back
int bytes = 0;
s.ReceiveTimeout = 3000;
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
string page = Encoding.ASCII.GetString(bytesReceived, 0, bytes);
s.Close();

你有什么疑问?也许编辑您的问题时有任何疑问?

At the root of it, STOMP appears to be TCP-based messaging with its set of commands and control characters.

There's nothing in .NET that should give you any doubts about not being able to build an application or library using this protocol. If you were building a .NET STOMP library from scratch, you'd have to leverage System.Net.Sockets. Here's some sample C# code.

Byte[] bytesSent = Encoding.ASCII.GetBytes(someStringMessage);

// Create a socket connection with the specified server and port.
Socket s = ConnectSocket("192.168.0.101", somePort);

// If the socket could not get a connection, then return false.
if (s == null)
    return false;

// Send message to the destination.
s.Send(bytesSent, bytesSent.Length, 0);

// Receive the response back
int bytes = 0;
s.ReceiveTimeout = 3000;
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
string page = Encoding.ASCII.GetString(bytesReceived, 0, bytes);
s.Close();

What doubts did you have? Perhaps edit your question with any concerns?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文