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

bf-lib-kafkacouch

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bf-lib-kafkacouch

Block-5 Kafka Couch Library

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
3
Weekly downloads
 
Created
Source

Description

This Library should handle all interactions between kafka and couch

Data Asumptions,

It Monitor's created and updated,

  • Created assume's no document exists, and creates a new one
  • Updated assumes Document exits
  • message has an id field, that is the id for the document

#Usage

import { taskSchema } from "bf-legal-task";
import { KafkaCouchWatcher } from "lib-kafkacouch";
const TaskWatcher = new KafkaCouchWatcher({
  subject: "task",
  couch: `workflow-task_management`,
  kafka: { topic: `WORKFLOW.TASK_MANAGEMENT`, groupId: "app-asdf" },
  bodyValidation: taskSchema,
  id: "id",
  filter: (body, type, header) => {
    return true;
  },
  map: (body, type, header) => {
    return body;
  }
});
//After a commit happens
TaskWatcher.on("updated", async (body, type, header) => {
  console.log(packet);
});

Without couch ( for command's ext... )

import { taskSchema } from "bf-legal-task";
import { KafkaCouchWatcher } from "lib-kafkacouch";
const TaskWatcher = new KafkaCouchWatcher({
  subject: "task",
  couch: false,
  kafka: { topic: `WORKFLOW.TASK_MANAGEMENT`, groupId: "app-asdf" },
  bodyValidation: taskSchema,
  filter: (body, type, header) => {
    return true;
  },
  map: (body, type, header) => {
    return body;
  }
});
//After a commit happens
TaskWatcher.on("updated", async (body, type, header) => {
  console.log(packet);
});

Config Stuff

Couch by default get's it's creds from enviromental variables

const COUCH_USER: string = process.env.COUCH_USER || "admin";
const COUCH_PASSWORD: string = process.env.COUCH_PASSWORD || "password";
const COUCH_PORT: string = process.env.COUCH_PORT || "5984";
const COUCH_HOST: string = process.env.COUCH_HOST || "couchdb";
const COUCH_PROTO: string = process.env.COUCH_PROTO || "http";
KafkaCouchWatcher.kafka
KeyDescriptionRequired
topicKafka Topictrue
groupIdGroup ID ( for Round Robin Groups )true
hostKafka Hostfalse
sessionTimeoutfalse
protocolfalse
fromOffsetfalse
protocolfalse
commitOffsetsOnFirstJoinfalse
outOfRangeOffsetfalse
onRebalancefalse
const k = {
  topic: `WORKFLOW.TASK_MANAGEMENT`,
  host: process.env.ZOOKEEPER_HOST || "zookeeper:2181",
  groupId: process.env.KAFKA_GROUP_ID || "default-groupa",
  sessionTimeout: 15000,
  protocol: ["roundrobin"],
  fromOffset: "earliest",
  commitOffsetsOnFirstJoin: true,
  outOfRangeOffset: "earliest",
  onRebalance: (isAlreadyMember: any, callback: any) => {
    callback();
  } // or null
};

FAQs

Package last updated on 26 Sep 2018

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