{"id":13624731,"url":"https://github.com/cainus/Prozess","last_synced_at":"2025-04-16T01:32:14.084Z","repository":{"id":4141429,"uuid":"5254480","full_name":"cainus/Prozess","owner":"cainus","description":"kafka library for node.js","archived":false,"fork":false,"pushed_at":"2017-04-17T08:29:53.000Z","size":700,"stargazers_count":133,"open_issues_count":16,"forks_count":41,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-27T11:16:52.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"krzyzanowskim/CryptoSwift","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cainus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-01T03:21:04.000Z","updated_at":"2020-09-07T08:26:46.000Z","dependencies_parsed_at":"2022-09-05T15:00:36.076Z","dependency_job_id":null,"html_url":"https://github.com/cainus/Prozess","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainus%2FProzess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainus%2FProzess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainus%2FProzess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainus%2FProzess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cainus","download_url":"https://codeload.github.com/cainus/Prozess/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223691746,"owners_count":17186876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:45.657Z","updated_at":"2025-04-16T01:32:14.063Z","avatar_url":"https://github.com/cainus.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Prozess\n=======\n[![Build\nStatus](https://secure.travis-ci.org/cainus/Prozess.png?branch=master)](http://travis-ci.org/cainus/Prozess)\n[![Coverage Status](https://coveralls.io/repos/cainus/Prozess/badge.png?branch=master)](https://coveralls.io/r/cainus/Prozess)\n\nProzess is a Kafka library for node.js\n\n[Kafka](http://incubator.apache.org/kafka/index.html) is a persistent, efficient, distributed publish/subscribe messaging system.\n\nThere are two low-level clients: The Producer and the Consumer:\n\n##Producer example:\n\n```javascript\nvar Producer = require('Prozess').Producer;\n\nvar producer = new Producer('social', {host : 'localhost'});\nproducer.connect();\nconsole.log(\"producing for \", producer.topic);\nproducer.on('error', function(err){\n  console.log(\"some general error occurred: \", err);  \n});\nproducer.on('brokerReconnectError', function(err){\n  console.log(\"could not reconnect: \", err);  \n  console.log(\"will retry on next send()\");  \n});\n\nsetInterval(function(){\n  var message = { \"thisisa\" :  \"test \" + new Date()};\n  producer.send(JSON.stringify(message), function(err){\n    if (err){\n      console.log(\"send error: \", err);\n    } else {\n      console.log(\"message sent\");\n    }\n  });\n}, 1000);\n```\n\n##Consumer example:\n\n```javascript\nvar Consumer = require('Prozess').Consumer;\n\nvar options = {host : 'localhost', topic : 'social', partition : 0, offset : 0};\nvar consumer = new Consumer(options);\nconsumer.connect(function(err){\n  if (err) {  throw err; }\n  console.log(\"connected!!\");\n  setInterval(function(){\n    console.log(\"===================================================================\");\n    console.log(new Date());\n    console.log(\"consuming: \" + consumer.topic);\n    consumer.consume(function(err, messages){\n      console.log(err, messages);\n    });\n  }, 7000);\n});\n\n```\n\nA `Consumer` can be constructed with the following options (default values as\nshown below):\n\n```javascript\nvar options = {\n  topic: 'test',\n  partition: 0,\n  host: 'localhost',\n  port: 9092,\n  offset: null, // Number, String or BigNum\n  maxMessageSize: Consumer.MAX_MESSAGE_SIZE,\n  polling: Consumer.DEFAULT_POLLING_INTERVAL\n};\n```\n\n##Documentation\n\n### `var producer = new Producer(options)`\n\n```ocaml\ntype Message := String | Buffer\n\nProducer := ({\n  topic: String,\n  partition?: Number,\n  host?: String,\n  port?: Number,\n  connectionCache?: Boolean\n}) =\u003e EventEmitter \u0026 {\n  connect: () =\u003e void,\n  send: (Array\u003cMessage\u003e | Message, opts?: {\n    partition?: Number,\n    topic?: String\n  }, cb: Callback\u003c\u003e) =\u003e void\n}\n```\n\nTo create a `producer` you must call `Producer()` with various\n  options. The only required argument is the topic your\n  producing to.\n  \n```js\nvar Producer = require('prozess').Producer\n\nvar producer = new Producer({ topic: 'foos' })\n```\n\n#### `options.topic`\n\n`options.topic` must be a `String` and is the topic\n  in kafka that you will producer to\n  \n#### `options.partition`\n\n`options.partition` is an optional `Number` and \n  defaults to `0`. You can specify this if you want\n  to change which `partition` you publish to.\n  \n#### `options.host` and `options.port`\n\n`options.host` determines the host location of the\n  kafka node you are connecting to and `options.port`\n  determines the port.\n  \nThese default to `\"localhost\"` and `9092` which are \n  the default kafka ports.\n  \n#### `options.connectionCache`\n\n`options.connectionCache` is a `Boolean` you can set\n  to opt in into connection caching. By default `prozess`\n  will create one TCP connection per topic.\n  \nIf you set `options.connectionCache` to true then \n  `prozess` will use one TCP connection per host \u0026 port.\n  \n#### `producer.connect(Callback)`\n\nYou can call `producer.connect(cb)` to open your connection\n  to kafka, the `cb` you pass in will be called once the\n  connection is open.\n  \nYou must call `.connect()` before calling `.send()`\n\n#### `producer.send(Message, opts?: Object, Callback)`\n\nTo produce messages to kafka you should call `.send()` with\n  either an array of `String`'s or a single `String`.\n  \nYou can pass `.send()` an optional options argument to \n  customize the `topic` \u0026 `partition` for this single `send()`\n  request.\n  \nYou must also supply a `Callback` to handle any asynchronous\n  errors.\n\n##Installation:\n\n     npm install prozess\n\n##Checkout the code and run the tests:\n\n     $ git clone https://github.com/cainus/Prozess.git\n     $ cd Prozess ; make test-cov \u0026\u0026 open coverage.html\n\n\n##Kafka Compatability matrix:\n\n\u003ctable\u003e\n  \u003ctr\u003e\n     \u003ctd\u003eKakfa 0.8.0 Release\u003c/td\u003e\u003ctd\u003eNot Supported\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eKafka 0.7.2 Release\u003c/td\u003e\u003ctd\u003eSupported\u003c/td\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eKafka 0.7.1 Release\u003c/td\u003e\u003ctd\u003eSupported\u003c/td\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eKafka 0.7.0 Release\u003c/td\u003e\u003ctd\u003eSupported\u003c/td\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ekafka-0.6\u003c/td\u003e\u003ctd\u003eNot Supported\u003c/td\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ekafka-0.05\u003c/td\u003e\u003ctd\u003eNot Supported\u003c/td\u003e\n\u003c/table\u003e\n\nVersions taken from http://incubator.apache.org/kafka/downloads.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainus%2FProzess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcainus%2FProzess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainus%2FProzess/lists"}