Implements the PubSubEngine interface from graphql-subscriptions using AMQP (RabbitMQ) as the pub/sub mechanism. Current stable version is 3.0.1, targeting graphql@16.x and graphql-subscriptions@3.x. Maintained since 2017 with periodic updates. Key differentiator vs alternatives like graphql-redis-subscriptions: it reuses existing amqplib connections and channels, offers flexible exchange/queue configuration, and supports topic exchanges for pattern-based routing.
npm install graphql-amqp-subscriptionsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to connect to RabbitMQ, create an AMQPPubSub instance, publish and subscribe using a topic exchange.
Upgrade to graphql@16 and graphql-subscriptions@3, or use graphql-amqp-subscriptions@2 for older dependencies.
Connect explicitly using amqplib.connect() and pass the resulting connection object.
Set unbindOnDispose: true and deleteOnDispose: true to automatically clean up queues and bindings on dispose.
Always call pubsub.dispose() and close the amqplib connection when done.
Wrap in a connection error listener and reinitialize pubsub on 'close' or 'error' events.
Use `import { AMQPPubSub } from 'graphql-amqp-subscriptions'` or enable esModuleInterop in tsconfig.Run `npm install graphql-amqp-subscriptions amqplib graphql graphql-subscriptions`.
Make sure the amqplib connection promise resolves before creating AMQPPubSub.
Ensure exchange options are correctly configured and the exchange exists, or set passive to false.