daishisystems/Daishi.AMQP
语言: C#
git: https://github.com/daishisystems/Daishi.AMQP
用于.NET应用程序的微服务SDK
正如在visualstudiomagazine.com上看到的那样。
微服务是轻量级服务的分组,互连,虽然彼此独立,但没有直接耦合或依赖。微服务允许在基础设施方面具有灵活性;应用程序流量路由到可以分布在CPU,磁盘,机器和网络上的服务集合,而不是用于管理所有流量的单个单一平台。
单击此处获取有关使用此框架构建微服务的深入教程。
安装
PM> Install-Package Daishi.AMQP
示例代码
连接到RabbitMQ
var adapter = RabbitMQAdapter.Instance;
adapter.Init("hostName", 1234, "userName", "password", 50);
adapter.Connect();
发送一个消息
var message = "Hello, World!";
adapter.Publish(message, "queueName");
检索消息
string output;
BasicDeliverEventArgs eventArgs;
adapter.TryGetNextMessage("queueName", out output, out eventArgs, 50);
不断轮询消息
var consumer = new RabbitMQConsumerCatchAll("queueName", 10);
adapter.ConsumeAsync(consumer);
Console.ReadLine();
adapter.StopConsumingAsync(consumer);
联系开发人员
请联系我并联系我以获取问题,建议,或者只是谈谈技术。
本文使用googletrans自动翻译,仅供参考, 原文来自github.com
Microservices SDK for .NET applications
As seen on visualstudiomagazine.com.
Microservices are groupings of lightweight services, interconnected, although independent of each other, without direct coupling or dependency. Microservices allow flexibility in terms of infrastructure; application traffic is routed to collections of services that may be distributed across CPU, disk, machine and network as opposed to a single monolithic platform designed to manage all traffic.
Click here for an in-depth tutorial on building Microservices using this framework.
Installation
PM> Install-Package Daishi.AMQP
Sample Code
Connect to RabbitMQ
var adapter = RabbitMQAdapter.Instance;
adapter.Init("hostName", 1234, "userName", "password", 50);
adapter.Connect();
Send a Message
var message = "Hello, World!";
adapter.Publish(message, "queueName");
Retrieve a Message
string output;
BasicDeliverEventArgs eventArgs;
adapter.TryGetNextMessage("queueName", out output, out eventArgs, 50);
Continuously Poll for Messages
var consumer = new RabbitMQConsumerCatchAll("queueName", 10);
adapter.ConsumeAsync(consumer);
Console.ReadLine();
adapter.StopConsumingAsync(consumer);
Contact the Developer
Please reach out and contact me for questions, suggestions, or to just talk tech in general.