kafka-observe
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -102,3 +102,3 @@ const { Consumer, ConsumerGroup, Producer } = require("./IO"); | ||
*/ | ||
callback: callbackController({ producer, consumer }), | ||
eventCallback: callbackController({ producer, consumer }), | ||
}; | ||
@@ -105,0 +105,0 @@ |
{ | ||
"name": "kafka-observe", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,3 +57,4 @@ # kafka-observe | ||
`producer`: instance of a connected producer | ||
`getTopicSubject`: a function that returns a topic to subscribe to with the correct strategy. | ||
`getTopicSubject`: a function that returns a topic to subscribe to with the correct strategy. | ||
`eventCallback`: a function that sends out an event and listens for a response | ||
@@ -67,3 +68,3 @@ ## getTopicSubject | ||
getTopicSubject.getTopicSubject({ | ||
getTopicSubject({ | ||
topic: "topic name", | ||
@@ -76,2 +77,19 @@ loadBalanced: "true|false", // True for Loadbalanced strategy false for All strategy | ||
## eventCallback | ||
Returns a subject you can subscribe to listen to events of a certain topic. | ||
```javascript | ||
const { eventCallback } = require("kafka-observe")(options); | ||
eventCallback({ | ||
topic: "topic name", | ||
sender: "event", | ||
listeners: ["listen_for_event"], | ||
payload: {} // An object you want send with the event (needs to be JSON convertable) | ||
}).then((event) => { | ||
// do something with the event | ||
}); | ||
``` | ||
## producer | ||
@@ -78,0 +96,0 @@ |
21403
131