-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unbuffered string error #2
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:14-alpine | ||
FROM node:18-alpine | ||
MAINTAINER Giuseppe Mandato <[email protected]> | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ version: "3.9" | |
|
||
services: | ||
kafka-producer: | ||
# build: . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest we'd avoid commented out code :) |
||
image: hitmands/kafka-producer-stub:latest | ||
environment: | ||
HKPS_BROKERS: "kafka:19092" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ export const createDispatcher = (clientId, producer) => ({ | |
{ partition = null, key = null, ts = Date.now() } = {} | ||
) => { | ||
console.log(`${clientId} / Producer.Dispatcher.Dispatch('${topic}')`); | ||
console.log("message", message.toString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might lead to a very verbose log, we should put it under a
|
||
|
||
return producer.produce(topic, partition, message, null, ts); | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ export const start = async ({ clientId, messenger }) => { | |
console.log(`${clientId} / Producer.Ready`); | ||
|
||
for await (const { topic, message, options } of messenger()) { | ||
dispatcher.dispatch(topic, message, options); | ||
dispatcher.dispatch(topic, Buffer(JSON.stringify(message)), options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see. Well I made this change because the code that's in
I see you are already aware of the fix and did so in a different place but maybe it just didn't make its way back to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a reasonable change to add, messages must be buffers, hence it makes sense to I'd suggest we'd use |
||
} | ||
|
||
console.log(`${clientId} / Producer.Done`); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳