RabbitMQ.Extension
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package RabbitMQ.Extension --version 1.0.0
NuGet\Install-Package RabbitMQ.Extension -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RabbitMQ.Extension" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RabbitMQ.Extension --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RabbitMQ.Extension, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RabbitMQ.Extension as a Cake Addin #addin nuget:?package=RabbitMQ.Extension&version=1.0.0 // Install RabbitMQ.Extension as a Cake Tool #tool nuget:?package=RabbitMQ.Extension&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
static void Main(string[] args)
{
var factory = new ConnectionFactory//创建连接工厂对象
{
HostName = "192.168.238.129",//IP地址
Port = 5672,//端口号
UserName = "admin",//用户账号
Password = "123",//用户密码
AutomaticRecoveryEnabled = true,
TopologyRecoveryEnabled = true,
RequestedConnectionTimeout = TimeSpan.FromSeconds(2)
};
TestWork(factory);
TestPubSub(factory);
TestRouting(factory);
TestTopic(factory);
Console.ReadKey();
}
private static void TestWork(IConnectionFactory factory)
{
var work = new RabbitWork(factory);
work.OnError(ex =>
{
Console.WriteLine(ex.Message);
});
work.OnConnect(() =>
{
Console.WriteLine("连接成功");
});
work.OnClose(() =>
{
Console.WriteLine("连接断开");
});
work.Start("test");
work.OnReceived((data, id) =>
{
var d = Encoding.UTF8.GetString(data);
Console.WriteLine(d);
});
Task.Run(() =>
{
while (true)
{
var data = Encoding.UTF8.GetBytes("你好work");
work.TryPublish(data);
Thread.Sleep(1000);
}
});
}
private static void TestPubSub(IConnectionFactory factory)
{
var work = new RabbitPubSub(factory);
work.OnError(ex =>
{
Console.WriteLine(ex.Message);
});
work.OnConnect(() =>
{
Console.WriteLine("连接成功");
});
work.OnClose(() =>
{
Console.WriteLine("连接断开");
});
work.Start("test2");
work.OnReceived((data, id) =>
{
var d = Encoding.UTF8.GetString(data);
Console.WriteLine(d);
});
Task.Run(() =>
{
while (true)
{
var data = Encoding.UTF8.GetBytes("你好pubsub");
work.TryPublish(data);
Thread.Sleep(1000);
}
});
}
private static void TestRouting(IConnectionFactory factory)
{
var work = new RabbitRouting(factory);
work.OnError(ex =>
{
Console.WriteLine(ex.Message);
});
work.OnConnect(() =>
{
Console.WriteLine("连接成功");
});
work.OnClose(() =>
{
Console.WriteLine("连接断开");
});
work.Start("test3");
var key = new List<string> { "aaa", "bbb" };
work.OnReceived((data, id, key) =>
{
var d = Encoding.UTF8.GetString(data);
Console.WriteLine(d);
Console.WriteLine(id);
Console.WriteLine(key);
}, key);
Task.Run(() =>
{
while (true)
{
var data = Encoding.UTF8.GetBytes("你好RoutingKey-aaa");
work.TryPublish(data, "aaa");
var data2 = Encoding.UTF8.GetBytes("你好RoutingKey-bbb");
work.TryPublish(data2, "bbb");
Thread.Sleep(1000);
}
});
}
private static void TestTopic(IConnectionFactory factory)
{
var work = new RabbitTopic(factory);
work.OnError(ex =>
{
Console.WriteLine(ex.Message);
});
work.OnConnect(() =>
{
Console.WriteLine("连接成功");
});
work.OnClose(() =>
{
Console.WriteLine("连接断开");
});
work.Start("test4");
var key = new List<string> { "ccc.abc" };
work.OnReceived((data, id, key) =>
{
var d = Encoding.UTF8.GetString(data);
Console.WriteLine(d);
Console.WriteLine(id);
Console.WriteLine(key);
}, key);
Task.Run(() =>
{
while (true)
{
var data = Encoding.UTF8.GetBytes("你好Topic-ccc");
work.TryPublish(data, "ccc.abc");
var data2 = Encoding.UTF8.GetBytes("你好Topic-ddd");
work.TryPublish(data2, "ccc.abd");
Thread.Sleep(1000);
}
});
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- RabbitMQ.Client (>= 6.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.