Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active December 8, 2024 02:37
Show Gist options
  • Select an option

  • Save wilmoore/8d008d5fdeeb89a4be627b35716c840c to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/8d008d5fdeeb89a4be627b35716c840c to your computer and use it in GitHub Desktop.
Software Engineering :: Message Queue :: Job Queue :: Software :: plumber

Software Engineering :: Message Queue :: Job Queue :: Software :: plumber

⪼ Made with 💜 by Polyglot.

resources

image

Write messages via pipe

Write multiple messages

NOTE: Multiple messages are separated by a newline.

$ cat mydata.txt
line1
line2
line3

$ cat mydata.txt | plumber write kafka --topics foo

INFO[0000] Successfully wrote message to topic 'foo'  pkg=kafka/write.go
INFO[0000] Successfully wrote message to topic 'foo'  pkg=kafka/write.go
INFO[0000] Successfully wrote message to topic 'foo'  pkg=kafka/write.go
Write each element of a JSON array as a message
$ cat mydata.json
[{"key": "value1"},{"key": "value2"}]

$ cat mydata.json | plumber write kafka --topics foo --input-as-json-array

INFO[0000] Successfully wrote message to topic 'foo'  pkg=kafka/write.go
INFO[0000] Successfully wrote message to topic 'foo'  pkg=kafka/write.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment