Skip to content

Commit af7079d

Browse files
committed
fix: producer
1 parent 9024a8e commit af7079d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/basket/src/lib/producer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ let connected = false;
1616
await producer.connect();
1717
connected = true;
1818

19-
export const sendEventSync = async (topic: string, event: any) => {
19+
export const sendEventSync = async (topic: string, event: any, key?: string) => {
2020
try {
2121
await producer.send({
2222
topic,
23-
messages: [{ value: event }],
23+
messages: [{
24+
value: JSON.stringify(event),
25+
key: key || event.client_id
26+
}],
2427
timeout: 10000,
2528
compression: CompressionTypes.GZIP,
2629
});

0 commit comments

Comments
 (0)