namespace Example.Controllers
{
[Route("/")]
[ApiController]
public class ExampleController : ControllerBase
{
readonly IRequestSender _requestSender;
public PurgeController(IRequestSender requestSender)
{
_requestSender = requestSender;
}
[HttpPost("example")]
public async Task<IActionResult> Example()
{
_requestSender.Send(descDTO);
}
}
}
namespace Example.Impl
{
public class MessageTransfer : IRequestProvider, IRequestSender
{
private readonly IStopTokenProvider _stopTokenProvider;
public MessageTransfer(IStopTokenProvider stopTokenProvider)
{
_stopTokenProvider = stopTokenProvider;
Task.Run(() => MessageTransferRunnerAsync());
}
private async Task MessageTransferRunnerAsync()
{
}
}
public bool Send(DescDTO descDTO)
{
if(!_testsDict.TryAdd(descDTO.Type, 1))
return false;
_queue.Enqueue(descDTO);
return true;
}
public DescDTO GetNextAsync(CancellationToken cancellationToken)
{
_queue.TryDequeue(descDTO);
}
}
namespace Example.Impl
{
public class Service
{
readonly IRequestProvider _requestProvider;
public Service(IRequestProvider requestProvider)
{
_requestProvider = requestProvider;
Task.Run(() => RunnerAsync());
}
private async Task RunnerAsync()
{
}
}
}