Socket
Socket
Sign inDemoInstall

graphql-kafkanode-subscriptions

Package Overview
Dependencies
106
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    graphql-kafkanode-subscriptions

Apollo graphql subscription over Kafka protocol


Version published
Maintainers
1
Install size
20.8 MB
Created

Readme

Source

graphql-kafka-subscriptions

Apollo graphql subscriptions over Kafka protocol

One producer and one consumer for each node instance. Communication happens over a single kafka topic.

Installation

npm install graphql-kafka-subscriptions

Usage

import { KafkaPubSub } from 'graphql-kafka-subscriptions'

export const pubsub = new KafkaPubSub({
  topic: 'anything',
  host: 'INSERT_KAFKA_IP',
  port: 'INSERT_KAFKA_PORT',
})

With multiple Kafka nodes

export const pubsub = new KafkaPubSub({
  topic: 'anything',
  host: 'kafka-10.development.foobar.com:9092,kafka-21.development.foobar.com:9092,kafka-22.development.foobar.com:9092',
})
// as mentioned in the comments of https://github.com/ancashoria/graphql-kafka-subscriptions/issues/4
// you will need to upate the site calls of `publish` in your application as called out below.

// the stock PubSub::publish expects a string and an object
      pubsub.publish('messageAdded', {
        messageAdded: newMessage,
        channelId: message.channelId
      });

// KafkaPubSub::publish expects the first parameter to be inserted into the object
      pubsub.publish({
        channel: 'messageAdded',
        messageAdded: newMessage,
        channelId: message.channelId
      });

Special thanks to:

  • davidyaha for graphql-redis-subscriptions which was the main inspiration point for this project
  • Apollo graphql community

Help greatly appreciated

Keywords

FAQs

Last updated on 29 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc