1.0.2 • Published 6 years ago

loopback-kafka-producer-mixin v1.0.2

Weekly downloads
15
License
Apache-2.0
Repository
github
Last release
6 years ago

NPM

loopback-kafka-producer-mixin

Kafka Producer mixin for loopback to add sendEvent method to your models.

INSTALL

  npm install loopback-kafka-producer-mixin --save

SERVER CONFIG

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-kafka-producer-mixin",
      "../common/mixins"
    ]
  }
}

MODEL CONFIG

To use with your Models add the mixins attribute to the definition object of your model config.

  {
    "name": "Widget",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "mixins": {
      "KafkaProducer" : true
    }
  }

CONNEXIONS

To be able to connect to your kafka host or zookeeper host, you have to set the KAFKA_URL env variable

export KAFKA_URL=192.168.99.100:2181

LICENSE

Apache-2.0

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago