Browse Source

Merge branch 'dev' into maliming/6385

pull/6417/head
maliming 6 years ago
parent
commit
18afc512fd
  1. 8
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs

8
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs

@ -21,7 +21,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected BackgroundJobConfiguration JobConfiguration { get; }
protected JobQueueConfiguration QueueConfiguration { get; }
protected IChannelAccessor ChannelAccessor { get; private set; }
protected EventingBasicConsumer Consumer { get; private set; }
protected AsyncEventingBasicConsumer Consumer { get; private set; }
public ILogger<JobQueue<TArgs>> Logger { get; set; }
@ -135,7 +135,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
if (AbpBackgroundJobOptions.IsJobExecutionEnabled)
{
Consumer = new EventingBasicConsumer(ChannelAccessor.Channel);
Consumer = new AsyncEventingBasicConsumer(ChannelAccessor.Channel);
Consumer.Received += MessageReceived;
//TODO: What BasicConsume returns?
@ -173,7 +173,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
return properties;
}
protected virtual void MessageReceived(object sender, BasicDeliverEventArgs ea)
protected virtual async Task MessageReceived(object sender, BasicDeliverEventArgs ea)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -185,7 +185,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
try
{
AsyncHelper.RunSync(() => JobExecuter.ExecuteAsync(context));
await JobExecuter.ExecuteAsync(context);
ChannelAccessor.Channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
}
catch (BackgroundJobExecutionException)

Loading…
Cancel
Save