Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

brod-caster

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brod-caster

Keep track of your micro-service messages and dispatch tasks accordingly

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

BrodCaster

Combines Apache Kafka & Google Protocol Buffers

Watch your Kafka message queue and dispatch tasks accordingly.

As Kafka's literary executor, Max Brod refused to follow the writer's instructions to burn his life's work, and had them published instead. (Wikipedia)

How to use

var kafka = new BrodCaster();

kafka.on('myService', 'eventName', function(data) {
  console.log(data);
});

kafka.send('myService', 'eventName', { my: 'data' }, function(err, result) {
  console.log(err || result);
})

Options

Use with Kafka

{
  adaptor: {
    type: 'protocolBuffer',
    // Append this value to the `eventName` value
    package: 'com.takeaway.events.cdn.page',
    // Path to `protoc` compiled message descriptors
    // Envelope has to have a message called `Envelope`
    envelope: './events/envelope.desc',
    messages: './events/my-events.desc'
  },

  topics: [
    {
      topic: 'service-broadcast'
    }, {
      topic: 'foo',
      offset: 20
    }
  ],

  client: {
    connectionString: 'localhost:2181/',
    // Set your own client name
    clientId: 'brod-caster',
    zkOptions: {}, // see: node-zookeeper-client
  },

  consumer: {
    // Default value for `protocolBuffer` adaptor
    encoding: 'buffer'
  },

  producer: {

  },

  // Only for testing purposes
  producerInstance: myInstance
}

Pass in options.parser & options.serializer functions to skip using adaptor.

API

on(origin, status, cb)

  • origin: String
  • status: String
  • cb: function(data, raw)
    • data: Object, the additional data sent with the message
    • raw: Object, the original message the consumer instance got

send(origin, status, data, cb)

  • origin: String
  • status: String
  • data
    • message: String, (required) name of the message data gets serialized by
    • (toProto: function, (optional) returns serialized message as Buffer for envelope - currently not supported)
    • data: Object, contains all required fields to serialize Message message
  • options:
    • topics: Array
    • partition: Number
    • attributes: Number
  • cb: function(err, result)

Keywords

FAQs

Package last updated on 21 May 2015

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