在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Surnet/graphql-amqp-subscriptions开源软件地址(OpenSource Url):https://github.com/Surnet/graphql-amqp-subscriptions开源编程语言(OpenSource Language):TypeScript 100.0%开源软件介绍(OpenSource Introduction):graphql-amqp-subscriptionsThis package implements the PubSubEngine Interface from the graphql-subscriptions package. It allows you to connect your subscriptions manager to a AMQP PubSub mechanism. This package is influenced by graphql-redis-subscriptions and graphql-rabbitmq-subscriptions. Basic usageimport { AMQPPubSub } from 'graphql-amqp-subscriptions';
import amqp from 'amqplib';
amqp.connect('amqp://guest:guest@localhost:5672?heartbeat=30')
.then(conn => {
const pubsub = new AMQPPubSub({
connection: conn
/* exchange: {
name: 'exchange',
type: 'topic',
options: {
durable: false,
autoDelete: true
}
},
queue: {
name: 'queue'
options: {
exclusive: true,
durable: true,
autoDelete: true
},
unbindOnDispose: false;
deleteOnDispose: false;
} */
});
// Use the pubsub instance from here on
})
.catch(err => {
console.error(err);
}); Benefits
DebugThis package uses Debug. To show the logs run your app with the environment variable DEBUG="AMQPPubSub" TestsYou'll need to have a local AMPQ instance such as RabbitMQ running to run tests. If you have Docker, you can run: docker run --hostname my-rabbit -p 5672:5672 rabbitmq:3 Then npm test |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论