Info
Version: | 1.0.6 |
Author(s): | [email protected] |
Last Update: | Sunday, July 4, 2021 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://www.virtuesoft.cn/ |
NuGet Url: | https://www.nuget.org/packages/Virtuesoft.Framework.Queue.Extensions |
Install
Install-Package Virtuesoft.Framework.Queue.Extensions
dotnet add package Virtuesoft.Framework.Queue.Extensions
paket add Virtuesoft.Framework.Queue.Extensions
Virtuesoft.Framework.Queue.Extensions Download (Unzip the "nupkg" after downloading)
Dependencies
- Microsoft.AspNetCore.Http.Abstractions(>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions(>= 3.1.0)
- Virtuesoft.Framework.Queue.Core(>= 1.0.0)
services.AddQueueService<RabbitQueueService>(new RabbitQueuOptions() {
Host = Configuration["rabbit.queque.host"],
Port = int.Parse(Configuration["rabbit.queque.port"]),
User = Configuration["rabbit.queque.user"],
Password = Configuration["rabbit.queque.user.password"],
VirtualHost = "/"
});
发送消息
await Context.SendQueueMessageAsync("rabbit.queque.name", message);
接收消息
var queque = Context.RequestServices.GetService(typeof(IQueueService)) as TRabbitQueueService;
await queque.ConnectionAsync("rabbit.queque.name", (sender, message) =>
{
var msg = Encoding.UTF8.GetString(message as byte[]);
});.