HarakaMQ
vert to netstandard and added more usability to the messagebroker
?目前,消息队列无法正常工作,我正在努力修复它。我正在这个分支上工作 https://github.com/Rotvig/HarakaMQ/tree/add_unit_tests ?
基于UDP的可靠消息中间件
https://www.nuget.org/packages/HarakaMQ.Client/
通过构建 MessageBroker 项目来启动 Broker,并使用命令“dotnet HarakaMQ.MessageBroker.dll”运行它。在集群设置中运行时,有一个单独的文件夹,其中包含为您拥有的每个代理构建的 dll。请记住在运行目录中添加一个“settings.json”文件,其中包含以下内容:
{
"BrokerPort" : 11100 ,
"PrimaryNumber" : 1 ,
"AntiEntropyMilliseonds" : 1000 ,
"RunInCLusterSetup" : false ,
"Brokers" :[]
}
var factory = new ConnectionFactory { HostName = "127.0.0.1" , ListenPort = 11000 , Port = 11100 } ;
using ( var connection = factory . CreateConnection ( ) )
using ( var channel = connection . CreateModel ( ) )
{
channel . QueueDeclare ( "hello" ) ;
channel . BasicPublish ( "hello" , Encoding . UTF8 . GetBytes ( "Hello world" ) ) ;
Console . WriteLine ( " Press [enter] to exit." ) ;
Console . ReadLine ( ) ;
}
var factory = new ConnectionFactory { HostName = "127.0.0.1" , ListenPort = 12000 , Port = 11100 } ;
using ( var connection = factory . CreateConnection ( ) )
using ( var channel = connection . CreateModel ( ) )
{
channel . QueueDeclare ( "hello" ) ;
var consumer = new DefaultBasicConsumer ( channel ) ;
consumer . Received += ( model , ea ) =>
{
Console . WriteLine ( Encoding . UTF8 . GetString ( ea . Body ) ) ;
} ;
channel . BasicConsume ( "hello" , consumer ) ;
Console . WriteLine ( " Press [enter] to exit." ) ;
Console . ReadLine ( ) ;
}
https://github.com/Rotvig/HarakaMQ-Benchmark