New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

estk-amqp-connector

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

estk-amqp-connector

Connect multiple applications using estk event stores so that they receive notifications when new events are published.

  • 0.0.8
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

estk-amqp-connector

Connect multiple applications using estk event stores so that they receive notifications when new events are published.

For example, with multiple load-balanced websocket servers, this can be used to distribute events to each server so that then can notify the conected clients of events that pertain to them.

NB: Does not handle bookmarking and is not durable.

AmqpMessageBus

  const { InMemoryEventStorage } = require('estk-events-in-memory');
  const { createEventStore } = require('estk-events');
  const { AmqpMessageBus } = require('estk-amqp-connector');

  const amqpConfig = {
    // url defaults to localhost
    // you probably want to set to something else in production
    url: 'amqp://guest:guest@localhost:5672',
    // exchange is optional, defaults to estk-events
    exchange: 'estk-amqp-example'
  };

  const storeA = await createEventStore(InMemoryStorage());
  const listenerA = await AmqpMessageBus(eventStore, amqpConfig);
  listenerA.onPublished(events => console.log('A was notified', events));

  const storeB = await createEventStore(InMemoryStorage());
  const listenerB = await AmqpMessageBus(eventStore, amqpConfig);
  listenerB.onPublished(events => console.log('B was notified', events));

  await storeA.publish({
    targetType: 'example-type',
    targetId: 'example-id',
    action: 'example-action',
    data: { sender: 'A'}
  });

  await storeB.publish({
    targetType: 'example-type',
    targetId: 'example-id',
    action: 'example-action',
    data: { sender: 'B'}
  });

  setTimeout(async () => {
    await storeA.close();
    await storeB.close();

  }, 1000);

FAQs

Package last updated on 24 Oct 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc