Git Product home page Git Product logo

sqspoller's People

Contributors

alexeybogdan95 avatar dsharkou avatar gitter-badger avatar tokarevaa avatar vitaly-zhuravkov avatar vladislavmorozovidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sqspoller's Issues

SqsPoller do not handle task cancellation correctly

Please take a look at next test:
https://github.com/IhnatKlimchuk/SqsPoller/blob/playground/test/SqsPoller.Tests.Unit/ConsumerResolverTests.cs#L184

Task cancelled this way causes ContinueWith task see task.IsCancelled == true but still deleting message from sqs.
example of consumer https://github.com/IhnatKlimchuk/SqsPoller/blob/playground/test/SqsPoller.Tests.Unit/ThrowingMessageConsumer.cs#L14

same issue is reproduced while stopping host

This issue is pretty important as caused some data loss on prod envs.

Issue in DateTime deserialization

Let us take following Json object:

 {
    "name":"test",
    "date":"2021-03-23T10:14:40.115+00:00"
 }

As you see, time is UTC, but if such object will be message body, it will be deserialized incorrectly. Its Kind property will have DateTimeKind.Local value. It seems to be easily fixed by adjusting Newtonsoft.Json settings. I reproduced same issue on test project with only Newtonsoft.Json serializing/deserializing

Add ability to set default log level on message handling error

private async Task ProcessEvent(Message message, CancellationToken cancellationToken, SemaphoreSlim semaphore, string queueUrl)
        {
            try
            {
                await _consumerResolver.Resolve(message, cancellationToken);
                DeleteMessage(queueUrl, message, cancellationToken);
            }
            catch (OperationCanceledException e)
            {
                _logger.LogWarning(e,
                    "Failed to handle message with id {message_id} and ReceiptHandle {receipt_handle}. Task has been cancelled");
            }
            catch (Exception e)
            {
                _logger.LogError(e,
                    "Failed to handle message with id {message_id} and ReceiptHandle {receipt_handle}");
            }
            finally
            {
                semaphore.Release();
            }
        }

Error during handling can be resulted by race condition and/or similar issue. Issue will cause retry by SQS, but you can't avoid Error logs, otherwise message will be assumed "consumed" correctly.

Add ability for one of

  • set log level on message handling error
  • pass consumption result to avoid deleting message
  • custom SqlPoller exception for "Warning" level similar to OperationCanceledException

SqsPoller do not have any limitation on messages consumed as result causing timeouts

Please see https://github.com/IhnatKlimchuk/SqsPoller/tree/playground/test/SqsPoller.LoadTest for more details.

SqsPoller tries to read all available messages. In case of huge amount of messages that leads to:

  • OOM
  • Timeouts on http calls if so exist in consumer (due to local queue LIFO in task scheduler, limited connection pool, bottleneck in consumer)
  • unplanned degradation on other parts of service (api calls in case service has such)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.