RabbitMQSimpleConnector
所属分类:中间件编程
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2022-12-08 01:12:40
上 传 者:
sh-1993
说明: RabbitMQ简单连接器
(RabbitMQ simple connector)
文件列表:
RabbitMQSimpleConnector.UnitTest/ (0, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/Aluno.cs (172, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/Properties/ (0, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/Properties/AssemblyInfo.cs (665, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/QueueManagerTests.cs (2167, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/RabbitMQSimpleConnector.UnitTest.csproj (4892, 2018-09-05)
RabbitMQSimpleConnector.UnitTest/packages.config (228, 2018-09-05)
RabbitMQSimpleConnector.nuspec (1135, 2018-09-05)
RabbitMQSimpleConnector.sln (1559, 2018-09-05)
RabbitMQSimpleConnector/ (0, 2018-09-05)
RabbitMQSimpleConnector/Entity/ (0, 2018-09-05)
RabbitMQSimpleConnector/Entity/ConnectionSetting.cs (678, 2018-09-05)
RabbitMQSimpleConnector/Library/ (0, 2018-09-05)
RabbitMQSimpleConnector/Library/Base/ (0, 2018-09-05)
RabbitMQSimpleConnector/Library/Base/BaseQueue.cs (1662, 2018-09-05)
RabbitMQSimpleConnector/Library/ChannelFactory.cs (1740, 2018-09-05)
RabbitMQSimpleConnector/Library/Consumer.cs (3845, 2018-09-05)
RabbitMQSimpleConnector/Library/Producer.cs (1601, 2018-09-05)
RabbitMQSimpleConnector/Library/ReceiveMessageException.cs (345, 2018-09-05)
RabbitMQSimpleConnector/Properties/ (0, 2018-09-05)
RabbitMQSimpleConnector/Properties/AssemblyInfo.cs (1417, 2018-09-05)
RabbitMQSimpleConnector/QueueManager.cs (3905, 2018-09-05)
RabbitMQSimpleConnector/RabbitMQSimpleConnector.csproj (3413, 2018-09-05)
RabbitMQSimpleConnector/packages.config (331, 2018-09-05)
# RabbitMQSimpleConnector
RabbitMQ Simple Connector
Develop branch
Master branch
How to use:
Install-Package RabbitMQSimpleConnector
```cs
using System;
using RabbitMQSimpleConnector.Entity;
namespace RabbitMQSimpleConnector.ExampleOfUse {
class Program {
static void Main() {
var connectionSetting = new ConnectionSetting() {
HostName = "
",
Password = "",
UserName = "",
VirtualHost = ""
};
queueManager = new QueueManager("queueTest")
.WithConnectionSetting(connectionSetting)
.WithProducer()
.WithConsumer();
queueManager.Consumer.WatchInit();
queueManager.Consumer.OnReceiveMessageException += (exception, deliveryTag) => {
Console.WriteLine(exception.Message);
queueManager.Consumer.Ack(deliveryTag);
};
queueManager.Consumer.ReceiveMessage += (aluno, deliveryTag) => {
Console.WriteLine($"Nome: {aluno.Nome} | Matricula: {aluno.Matricula} | DeliveryTag: {deliveryTag}");
queueManager.Consumer.Ack(deliveryTag);
};
for (var index = 1; index <= 1000; index++) {
queueManager.Producer?.Publish(new Aluno() {
Nome = "Slash",
Matricula = $"{index}"
});
}
Console.ReadKey();
}
}
public class Aluno {
public string Nome { get; set; }
public string Matricula { get; set; }
}
}
```
近期下载者:
相关文件:
收藏者: