Coder Social home page Coder Social logo

ali-essam / wtsqs Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 3.0 820 KB

Simplified Node AWS SQS Worker Wrapper

Home Page: https://www.npmjs.com/package/wtsqs

License: MIT License

JavaScript 100.00%
async aws es6 javascript job js nodejs npm promise queue sqs sqs-interface worker

wtsqs's People

Contributors

ali-essam avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wtsqs's Issues

Jobs with the same group id don't get processed sequentially

Hi Ali

when we have maxConcurrency > 1
i noticed that the worker process jobs with the same group id concurrently
but to process them in order they need be processed sequentially instead

i think that happen because when the worker receive multiple messages as a batch
the code uses promise.all to process all without considering messages with the same group id

enqueueMany fails if message list is empty

{ MissingParameter: The request must contain the parameter SendMessageBatchRequestEntry.1.Id.
    at Request.extractError 
....
  message: 'The request must contain the parameter SendMessageBatchRequestEntry.1.Id.',
  code: 'MissingParameter',
  time: 2019-06-19T09:58:56.933Z,
  requestId: 'XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX,
  statusCode: 400,
  retryable: false,
  retryDelay: 8.720774804845522 }

Job router worker handler

Utility function that facilitates routing different jobs to different handlers.

For example

const handler = new JobRouter({
  key: 'type',
  handlers: {
    'type_1': handler1Foo,
    'type_2': handler2Foo,
  },
  defaultHandler: defaultHandlerFoo
})

Support extending job visibility timeout

When fetching a message from SQS, visibilityTimeout (Duration (in seconds) that the received messages are hidden from subsequent retrieve requests.) is determined at request time

In some cases, the timeout might not be clear during the request and the processing job might need more time to process the message. Currently, if the visibilityTimeout is less than the job processing time, that will cause the message to be back in the queue and visible to other workers to fetch again, causing double processing of the same message.

It's possible through SQS API to extend the timeout after fetching the message through ChangeMessageVisibility.

TODO: Implement this functionality in WTSQS.

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.