This commit is contained in:
Suphonchai Phoonsawat 2026-05-12 16:32:46 +07:00
parent 4dc8849b31
commit cc251f7129
146 changed files with 2465 additions and 4785 deletions

View file

@ -0,0 +1,22 @@
using System.Threading.Channels;
namespace BMA.EHR.Recruit.Services;
public class ImportJobQueue
{
private readonly Channel<ImportJobInfo> _channel = Channel.CreateBounded<ImportJobInfo>(new BoundedChannelOptions(100)
{
FullMode = BoundedChannelFullMode.Wait,
SingleReader = true
});
public async ValueTask EnqueueAsync(ImportJobInfo job, CancellationToken cancellationToken = default)
{
await _channel.Writer.WriteAsync(job, cancellationToken);
}
public async ValueTask<ImportJobInfo> DequeueAsync(CancellationToken cancellationToken)
{
return await _channel.Reader.ReadAsync(cancellationToken);
}
}