1
This commit is contained in:
parent
256ce4d543
commit
e51f5509ea
@ -18,7 +18,7 @@
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
|
||||
<PackageReference Include="DotNetCore.Natasha.CSharp" Version="5.2.2.1"/>
|
||||
<PackageReference Include="Fake.AspNetCore" Version="8.0.0-preview.5" />
|
||||
<PackageReference Include="Fake.EventBus.RabbitMQ" Version="8.0.0-preview.5" />
|
||||
<PackageReference Include="Fake.EventBus.RabbitMQ" Version="8.0.0-preview.6" />
|
||||
<PackageReference Include="Fake.ObjectMapping.AutoMapper" Version="8.0.0-preview.5" />
|
||||
<PackageReference Include="FreeRedis" Version="1.3.6" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -14,6 +14,9 @@ public class RabbitClient(
|
||||
public void Subscribe(ConsumeOptions consumeOptions)
|
||||
{
|
||||
using var channelAccessor = channelPool.Acquire(consumeOptions.Queue);
|
||||
|
||||
if (!channelAccessor.IsNew) return;
|
||||
|
||||
var channel = channelAccessor.Channel;
|
||||
|
||||
consumeOptions.Declaration.Invoke(channel);
|
||||
@ -36,6 +39,11 @@ public class RabbitClient(
|
||||
}
|
||||
};
|
||||
|
||||
channel.CallbackException += (sender, args) =>
|
||||
{
|
||||
logger.LogError(args.Exception, "RabbitMQ channel exception");
|
||||
};
|
||||
|
||||
channel.BasicConsume(queue: consumeOptions.Queue,
|
||||
autoAck: false,
|
||||
consumer: consumer);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user