{"id":21389768,"url":"https://github.com/sshivananda/ts-sqs-consumer","last_synced_at":"2025-07-13T16:30:32.196Z","repository":{"id":37034193,"uuid":"256518154","full_name":"sshivananda/ts-sqs-consumer","owner":"sshivananda","description":"Typescript based sqs consumer","archived":false,"fork":false,"pushed_at":"2024-09-06T09:46:34.000Z","size":616,"stargazers_count":3,"open_issues_count":74,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-28T13:16:14.444Z","etag":null,"topics":["polling","sqs-consumer","ts-sqs-consumer"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshivananda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-17T13:58:54.000Z","updated_at":"2023-03-17T02:17:35.000Z","dependencies_parsed_at":"2023-02-07T19:31:58.185Z","dependency_job_id":"c7a9ed2a-c2d2-4ce4-b3a0-d38e6d8f9e5d","html_url":"https://github.com/sshivananda/ts-sqs-consumer","commit_stats":{"total_commits":205,"total_committers":5,"mean_commits":41.0,"dds":0.07804878048780484,"last_synced_commit":"d53919379164ff8cc31c3c0be3c8512667f63389"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshivananda%2Fts-sqs-consumer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshivananda%2Fts-sqs-consumer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshivananda%2Fts-sqs-consumer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshivananda%2Fts-sqs-consumer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshivananda","download_url":"https://codeload.github.com/sshivananda/ts-sqs-consumer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225896790,"owners_count":17541567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["polling","sqs-consumer","ts-sqs-consumer"],"created_at":"2024-11-22T12:28:31.103Z","updated_at":"2024-11-22T12:28:31.779Z","avatar_url":"https://github.com/sshivananda.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-sqs-consumer\n\nTypescript based sqs consumer. Handles message transport and deletion from\nSQS: just add a handler function for the messages from SQS to get started.\n\nIntegrated with localstack, codeClimate, fossa.\n\nBuild Stats:\n\n![npm](https://img.shields.io/npm/dm/ts-sqs-consumer)\n![GitHub Workflow Status (branch)](https://github.com/sshivananda/ts-sqs-consumer/workflows/Node.js%20CI/badge.svg?event=push)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/sshivananda/ts-sqs-consumer/issues)\n\nMaintainability stats:\n\n![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability-percentage/sshivananda/ts-sqs-consumer)\n![Code Climate coverage](https://img.shields.io/codeclimate/coverage/sshivananda/ts-sqs-consumer)\n[![GitHub issues](https://img.shields.io/github/issues/sshivananda/ts-sqs-consumer?label=Open%20Issues)](https://github.com/sshivananda/ts-sqs-consumer/issues)\n\nPublish stats:\n\n![npm](https://img.shields.io/npm/v/ts-sqs-consumer)\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/sshivananda/ts-sqs-consumer?label=Git%20Tag)\n![GitHub](https://img.shields.io/github/license/sshivananda/ts-sqs-consumer)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsshivananda%2Fts-sqs-consumer.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsshivananda%2Fts-sqs-consumer?ref=badge_shield)\n\nDependencies:\n\n![David - Dependencies](https://img.shields.io/david/sshivananda/ts-sqs-consumer)\n![David - Dev Dependencies](https://img.shields.io/david/dev/sshivananda/ts-sqs-consumer?color=green)\n\n## Table Of Contents\n\n- [Background](#background)\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n\n## Background\n\n`ts-sqs-consumer` allows you to start processing messages from SQS by just\npassing in the connection configuration options and defining what needs to\nbe done as part of the job processing.\n\n- Establishes a connection to the sqs queue\n- [Longpolls](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html)\n  for messages\n- If messages are found: processes them using the processor function used\n- If the message processing is successful: the message is deleted from the queue\n\nThe library has a heavy emphasis on code quality and is integrated with\nthe following tools:\n\n- Integrated with [local stack](https://localstack.cloud/) to run integration tests.\n  This ensures that the library is tested as it would be expected to be used in a\n  live environment.\n- [Code Climate](https://codeclimate.com/github/sshivananda/ts-sqs-consumer/): for\n  code quality and maintainability\n- [FOSSA](https://app.fossa.io/projects/git%2Bgithub.com%2Fsshivananda%2Fts-sqs-consumer) -\n  for license check. Verfies that dependencies used in this library\n  do not go beyond the license that this library adheres to. A detailed link\n  is available in the [License](##License) section of the document.\n- Whitesource to scan for security vulnerabilities. Note that this does not\n  currently cause build failures: but does get reported as an open issue.\n\n## Installation\n\n```bash\nnpm install ts-sqs-consumer\n```\n\n## Usage\n\n```ts\nimport { SQSConsumer } from 'ts-sqs-consumer';\n\n// Define a datatype for the message being consumed\ntype TestMessageType = {\n  orderId: string;\n  handle: string;\n};\n\nconst tsSQSConsumer: SQSConsumer\u003cTestMessageType\u003e = new SQSConsumer({\n    // Provide the connection options\n    sqsOptions: {\n      clientOptions: {\n        region: 'us-east-1',\n      },\n      receiveMessageOptions: {\n        queueUrl: 'url-of-your-queue',\n        visibilityTimeout: 1800,\n        waitTimeSeconds: 20,\n        maxNumberOfMessages: 1,\n        stopAtFirstError: false,\n      },\n    },\n    // Define what needs to be done with each message\n    jobProcessor: (async (message: TestMessageType) =\u003e {\n      console.log('Got message');\n      console.log(message);\n      // other processing steps\n    }),\n  });\n\n  // Start processing messages\n  await tsSQSConsumer\n    .processPendingJobs()\n    .catch((err: Error): void =\u003e {\n      throw err;\n    });\n```\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsshivananda%2Fts-sqs-consumer.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsshivananda%2Fts-sqs-consumer?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshivananda%2Fts-sqs-consumer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshivananda%2Fts-sqs-consumer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshivananda%2Fts-sqs-consumer/lists"}