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

kafka-please

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kafka-please

A pre-built version of Kafka that can be started and stopped from Node.js

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by450%
Maintainers
1
Weekly downloads
 
Created
Source

Kafka Please

This npm module lets you start up a Kafka broker (including ZooKeeper) locally. It's meant to facilitate integration tests when you need to test against a Kafka broker.

You need Java in order to run Kafka. This npm module assumes that you already have Java installed.

Usage:

npm install kafka-please --save-dev

const makeKafkaServer = require('kafka-please');

makeKafkaServer().then(kafkaServer => {
  // Do stuff that needs a Kafka broker here
  console.log('made kafka server', kafkaServer);
  console.log('zookeeper listens on', kafkaServer.zookeeperPort);
  console.log('kafka listens on', kafkaServer.kafkaPort);

  // Remember to shut down the server afterwards!
  return kafkaServer.close().then(() => {
    console.log('stopped kafka server');
    return Promise.resolve();
  });
});

Timeouts in mocha

Typically, starting a Kafka server takes ~2-3 seconds, and can make your mocha tests time out, if you don't override the timeout:

describe('my integration test', () => {
  it('should use kafka', function() {
    this.timeout(60000); // Set timeout to 60 seconds, just to be sure
    // start kafka, run integration tests etc. here
  });
});

Developing

  • git clone this project
  • run fetch.sh to download Kafka and unzip it
  • run npm install to get dependencies
  • npm test will run the integration tests.

FAQs

Package last updated on 09 Mar 2017

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