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