{"id":20147696,"url":"https://github.com/surnet/graphql-amqp-subscriptions","last_synced_at":"2025-04-04T17:10:42.449Z","repository":{"id":34187776,"uuid":"171265715","full_name":"Surnet/graphql-amqp-subscriptions","owner":"Surnet","description":"A graphql subscriptions implementation using amqp and apollo's graphql-subscriptions","archived":false,"fork":false,"pushed_at":"2025-03-07T12:50:33.000Z","size":465,"stargazers_count":38,"open_issues_count":5,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T16:09:44.663Z","etag":null,"topics":["amqp","api","graphql","rabbitmq","subscriptions"],"latest_commit_sha":null,"homepage":"","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/Surnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"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},"funding":{"github":["chdanielmueller"]}},"created_at":"2019-02-18T10:45:06.000Z","updated_at":"2025-03-07T12:49:59.000Z","dependencies_parsed_at":"2024-01-19T15:36:37.267Z","dependency_job_id":"b4ab29c0-badc-4789-aebe-075012a5eec8","html_url":"https://github.com/Surnet/graphql-amqp-subscriptions","commit_stats":{"total_commits":52,"total_committers":5,"mean_commits":10.4,"dds":"0.13461538461538458","last_synced_commit":"2ce47558e38262aa4b890ddf2563cc90f05da33c"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surnet%2Fgraphql-amqp-subscriptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surnet%2Fgraphql-amqp-subscriptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surnet%2Fgraphql-amqp-subscriptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Surnet%2Fgraphql-amqp-subscriptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Surnet","download_url":"https://codeload.github.com/Surnet/graphql-amqp-subscriptions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217222,"owners_count":20903009,"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":["amqp","api","graphql","rabbitmq","subscriptions"],"created_at":"2024-11-13T22:30:39.227Z","updated_at":"2025-04-04T17:10:42.434Z","avatar_url":"https://github.com/Surnet.png","language":"TypeScript","funding_links":["https://github.com/sponsors/chdanielmueller"],"categories":[],"sub_categories":[],"readme":"# graphql-amqp-subscriptions\n\nThis package implements the PubSubEngine Interface from the [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) package.\nIt allows you to connect your subscriptions manager to a AMQP PubSub mechanism.\n\nThis package is influenced by [graphql-redis-subscriptions](https://github.com/davidyaha/graphql-redis-subscriptions) and [graphql-rabbitmq-subscriptions](https://github.com/cdmbase/graphql-rabbitmq-subscriptions).\n\n[![npm Version](https://img.shields.io/npm/v/graphql-amqp-subscriptions.svg)](https://www.npmjs.com/package/graphql-amqp-subscriptions)\n[![npm Downloads](https://img.shields.io/npm/dm/graphql-amqp-subscriptions.svg)](https://www.npmjs.com/package/graphql-amqp-subscriptions)\n\n## graphql-subscriptions@2\n\nIf you are using `graphql-subscriptions@2.x` please use `graphql-amqp-subscriptions@2`.\n\n## Basic usage\n\n```javascript\nimport { AMQPPubSub } from 'graphql-amqp-subscriptions';\nimport amqp from 'amqplib';\n\namqp.connect('amqp://guest:guest@localhost:5672?heartbeat=30')\n.then(conn =\u003e {\n  const pubsub = new AMQPPubSub({\n    connection: conn\n    /* exchange: {\n       name: 'exchange',\n       type: 'topic',\n       options: {\n         durable: false,\n         autoDelete: true\n       }\n     },\n     queue: {\n       name: 'queue'\n       options: {\n         exclusive: true,\n         durable: true,\n         autoDelete: true\n       },\n       unbindOnDispose: false;\n       deleteOnDispose: false;\n     } */\n  });\n  // Use the pubsub instance from here on\n})\n.catch(err =\u003e {\n  console.error(err);\n});\n```\n\n## Benefits\n\n- Reusing existing [amqplib](https://github.com/squaremo/amqp.node) Connection\n- Reusing channels (one for subscriptions, one for publishing)\n- Performance/Ressource-usage benefits on AMQP (RabbitMQ) because of the aforementioned reasons [more info](https://www.cloudamqp.com/blog/2018-01-19-part4-rabbitmq-13-common-errors.html)\n- Using Topic Exchange (e.g. you publish to `agreements.eu.berlin.headstore` and subscribe to `agreements.eu.#`) [more info](https://www.cloudamqp.com/blog/2015-09-03-part4-rabbitmq-for-beginners-exchanges-routing-keys-bindings.html)\n\n## Debug\n\nThis package uses Debug.\nTo show the logs run your app with the environment variable DEBUG=\"AMQPPubSub\"\n\n## Tests\n\nYou'll need to have a local AMPQ instance such as RabbitMQ running to run tests.\n\nIf you have [Docker](https://www.docker.com/), you can run:\n\n```bash\ndocker run --hostname my-rabbit -p 5672:5672 rabbitmq:3\n```\n\nThen\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurnet%2Fgraphql-amqp-subscriptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurnet%2Fgraphql-amqp-subscriptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurnet%2Fgraphql-amqp-subscriptions/lists"}