AMQP Plugin

Subscriptions are only available as a beta; its API may change in the future. It is not recommended to use subscriptions in production environments.

The @neo4j/graphql-plugin-subscriptions-amqp plugin connects to brokers through AMQP 0-9-1 protocol such as:

It can be installed with npm:

npm install @neo4j/graphql-plugin-subscriptions-amqp
AMQP 1.0 is not supported by this plugin.

Usage

const { Neo4jGraphQLSubscriptionsAMQPPlugin } = require("@neo4j/graphql-plugin-subscriptions-amqp");

const plugin = new Neo4jGraphQLSubscriptionsAMQPPlugin({
    connection: {
        hostname: "localhost",
        username: "guest",
        password: "guest",
    }
});

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    driver,
    plugins: {
        subscriptions: plugin,
    },
});

API

The following options can be passed to the contructor:

  • connection: An AMQP uri as a string or a configuration object:

  • hostname: Hostname to be used, defaults to localhost.

  • username: defaults to guest.

  • password: defaults to guest.

  • port: Port of the AMQP broker, defaults to 5672.

  • exchange: The exchange to be used in the broker. Defaults to neo4j.graphql.subscriptions.fx.

  • version: The AMQP version to be used. Currently only 0-9-1 is supported.

Additionally, any option supported by amqplib can be passed to connection.

close(): Promise<void>

Closes the connection and channel created and unbinds the event emitter.