npm.io
0.0.0-beta.11 • Published 5 years ago

zoraclient

Licence
MIT
Version
0.0.0-beta.11
Deps
5
Size
406 kB
Vulns
0
Weekly
0

zorajs

Zora JavaScript client for writing Kafka messages to ZoraCloud

Getting Startted

To procuce messages using ZoraClient from a javascript application you need to:

  1. Add npm i zoraclient or yarn add zoraclient as a dependency to your package.json

  2. Add imports:

    import { Producer } from "zoraclient";
  3. Create a Producer Instance client:

    /**
     * Topic : Kafka topic to write to
    * address: GRPC port to send messages
    * Message: Messages to send to kafka topic
    */
    const data = {
    produceRequest: {
        topic: "devices",
        keyValue: "5nsdu930wdnl2n3nck",
        message: "samplemessagetobesent",
        address: "localhost:9000", 
    },
    };
    
    function main() {
    const stream = new Producer({ ...data.produceRequest });
    const output = stream.produce();
    console.log(output);
    }
    
    main();