1.0.8 • Published 4 years ago
@rocketseat/kafka-typings v1.0.8
Kafka Typings
This package exports typings for Kafka topics and messages so we can keep a pattern of the data exchanged between the micro-services.
Usage example
import * as PlutoKafka from '@rocketseat/kafka-typings/types/pluto';
import { kafka } from 'example-kafka-client-path';
const message: PlutoKafka.SignatureCreatedMessage = {
// this will be typed
}
kafka.emit(PlutoKafka.TOPICS.SIGNATURE_CREATED, message);Using locally
To use this package locally, we will use yalc that works like a local store for NPM packages.
First, install yalc globally using NPM or Yarn.
yarn global add yalc
npm i yalc -gPublish package to local store
Inside the kafka-typings folder, after changing it's code, you can:
yalc publishThis will publish the package to the local store.
Use the package inside another project
Inside the project folder, run:
yalc link @rocketseat/kafka-typingsUpdate the package code
You can always refresh the package code using yalc update, this will bring the latest version of the code from within the local store (this will only works after a yalc publish).
Keep it out of Git
Always remember to include yalc.lock and .yalc folder inside the .gitignore file on the project folder.