Skip to content

Stacking received data and toppling on stack limit for bulk operations

License

Notifications You must be signed in to change notification settings

cetingokhan/Stower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stower

Stacks incoming data and toppling it for batch operation when it comes to the stack limit

Microsoft.Extensions.DependencyInjection

services.AddStower(options =>
{
    options.MaxStackLenght = Convert.ToInt32(_configuration["Stower:MaxStackLenght"]);
    options.MaxWaitInSecond = Convert.ToInt32(_configuration["Stower:MaxWaitInSecond"]);
    options.Stacks = new List<Stower.Base.ICustomStack>()
    {
        new CustomStack<WeatherData>()
    };
}).AddToppleHandler<ToppleHandler>();

Sample injection and stack received data

[ApiController]
[Route("weather")]
public class WeatherController : ControllerBase    
{
    private readonly IStower _stower;

    public WeatherController(IStower stower)
    {
        _stower = stower;
    }
    [HttpPost]
    public async Task<IActionResult> AddNew(WeatherData item)
    {
        await _stower.Add<WeatherData>(item);
        return Ok();
    }
}

Topple Handler -> It calls when stack count comes to the limit

public class ToppleHandler : IToppleHandler
{
    public async Task Handle(List<object> objects)
    {

    }
}

About

Stacking received data and toppling on stack limit for bulk operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages