Plumber

​

Plumber is a Swiss army knife CLI tool for interacting with various messaging systems.

Source Code

Installation

Mac
Linux
Windows
Docker
Compile From Source
Mac

Install via Homebrew

$ brew tap batchcorp/public
$ brew install plumber

Download Latest Binary

Linux

Install via Homebrew

$ brew tap batchcorp/public
$ brew install plumber

Download Latest Binary

Docker
docker pull batchcorp/plumber:latest
Compile From Source
$ git clone https://github.com/batchcorp/plumber.git
$ cd plumber
$ make build

Compiled binaries will be available under the build/ directory

History of Plumber

Here at Batch, we're obviously big fans of messaging systems and event-driven architecture. While these paradigms make for wonderfully resilient platforms, they can be difficult to test, often requiring one-off scripts to emit whatever event is needed. This can quickly get messy, especially when dealing with serialization formats like protocol buffers.

We created Plumber as a handy tool for our engineers to test and develop our own platform, allowing any number of system components to be tested simply by emitting the necessary event with the necessary data. This tool became so indispensable to us that we decided to open-source and expand it for the benefit of the software engineering community.

What does plumber do?

Simply put: Plumber allows you to read and write data to various messaging systems via the command line, without having to write hacky scripts or learn the complicated APIs of most messaging systems.

Supported Messaging Systems

  • Kafka

  • RabbitMQ

  • Google Cloud Platform PubSub

  • MQTT

  • Amazon SQS

  • Amazon SNS (Publishing)

  • ActiveMQ

  • Azure Service Bus

  • NATS

  • Redis PubSub

  • Redis Streams

Writing Messages

Plumber can write the following formats:

Protocol Buffers
AVRO
Binary
Plain text
Protocol Buffers

Plumber can take your .proto definitions, a JSON representation of the message, and emit the protocol buffer message without any additional tools.

plumber write kafka \
--topic new_orders
--protobuf-dir path/to/myprotos \
--protobuf-root-message Order \
--input-type jsonpb \
--input-file proto_message.json
AVRO

By specifying the path to an .avsc AVRO schema file, plumber can easily emit AVRO serialized messages.

plumber write kafka \
--topic new_orders \
--avro-schema path/to/schema.avsc \
--input-file path/to/message.json
Binary

Binary file:

plumber write kafka --topic new_orders --input-file some.bin

Base64 encoded string:

plumber write kafka \
--topic new_orders \
--input-type base64 \
--input-data=d2mUgbG92ZSBtZXNzYWdp1bmc=
Plain text

Plain text file:

plumber write kafka --topic new_orders --input-file message.json

Plain text string:

plumber write kafka --topic new_orders --input-data "Hello world!"

Reading Messages

In addition to outputting the raw message contents, Plumber can also automatically decode multiple serialization/wire formats and display the decoded result.

Protocol Buffers
AVRO
GZIP
Base64
Protocol Buffers

Plumber will output a JSON representation of the protobuf message

plumber read kafka \
--topic new_orders \
--protobuf-dir path/to/myprotos \
--protobuf-root-message Order
AVRO
plumber read kafka \
--topic new_orders \
--avro-schema=path/to/schema.avsc
GZIP
plumber read kafka --topic new_orders --convert gzip
Base64
plumber read kafka --topic new_orders --convert base64

Relaying

Plumber's relay mode is used to ship messages from your messaging system directly to a Batch collection.

For more information on how to relay, check the relay docs.