All Projects → sevagh → Pq

sevagh / Pq

Licence: mit
a command-line Protobuf parser with Kafka support and JSON output

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Pq

Schema Registry
Confluent Schema Registry for Kafka
Stars: ✭ 1,647 (+1272.5%)
Mutual labels:  protobuf, kafka
Istio Micro
istio 微服务示例代码 grpc+protobuf+echo+websocket+mysql+redis+kafka+docker-compose
Stars: ✭ 194 (+61.67%)
Mutual labels:  protobuf, kafka
Netty Learning Example
🥚 Netty实践学习案例,见微知著!带着你的心,跟着教程。我相信你行欧。
Stars: ✭ 2,146 (+1688.33%)
Mutual labels:  protobuf, kafka
Proto
parser for Google ProtocolBuffers definition
Stars: ✭ 359 (+199.17%)
Mutual labels:  protobuf, parser
Pbparser
Golang library for parsing protocol buffer (.proto) files
Stars: ✭ 30 (-75%)
Mutual labels:  protobuf, parser
Plumber
A swiss army knife CLI tool for interacting with Kafka, RabbitMQ and other messaging systems.
Stars: ✭ 514 (+328.33%)
Mutual labels:  protobuf, kafka
Trubka
A CLI tool for Kafka
Stars: ✭ 296 (+146.67%)
Mutual labels:  protobuf, kafka
Flow Pipeline
A set of tools and examples to run a flow-pipeline (sFlow, NetFlow)
Stars: ✭ 86 (-28.33%)
Mutual labels:  protobuf, kafka
Myth
Reliable messages resolve distributed transactions
Stars: ✭ 1,470 (+1125%)
Mutual labels:  protobuf, kafka
Ltgt
Lightweight HTML processor
Stars: ✭ 117 (-2.5%)
Mutual labels:  parser
Java Petitparser
Dynamic parser combinators in Java.
Stars: ✭ 118 (-1.67%)
Mutual labels:  parser
Cmak
CMAK is a tool for managing Apache Kafka clusters
Stars: ✭ 10,544 (+8686.67%)
Mutual labels:  kafka
Awesome Kafka
A collection of kafka-resources
Stars: ✭ 116 (-3.33%)
Mutual labels:  kafka
Fast Data Dev
Kafka Docker for development. Kafka, Zookeeper, Schema Registry, Kafka-Connect, Landoop Tools, 20+ connectors
Stars: ✭ 1,707 (+1322.5%)
Mutual labels:  kafka
Lua Gumbo
Moved to https://gitlab.com/craigbarnes/lua-gumbo
Stars: ✭ 116 (-3.33%)
Mutual labels:  parser
Pants
The Pantsbuild developer workflow system
Stars: ✭ 1,814 (+1411.67%)
Mutual labels:  protobuf
Chirp
A modern low-level programming language
Stars: ✭ 116 (-3.33%)
Mutual labels:  parser
Spec
The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.
Stars: ✭ 1,860 (+1450%)
Mutual labels:  kafka
Rust hdl
Stars: ✭ 120 (+0%)
Mutual labels:  parser
Html2pug
Converts HTML to Pug 🐶
Stars: ✭ 118 (-1.67%)
Mutual labels:  parser

pq license Crates.io

protobuf to json deserializer, written in Rust

pq is a tool which deserializes protobuf messages given a set of pre-compiled .fdset files. It can understand varint/leb128-delimited/i32be streams, and it can connect to Kafka.

pq will pretty-print when outputting to a tty, but you should pipe it to jq for more fully-featured json handling.

Download

pq is on crates.io: cargo install pq. You can also download a static binary from the releases page.

Usage

new You can now pass in a proto file and have pq compile it on the fly using protoc:

$ pq --protofile ./tests/protos/dog.proto  --msgtype com.example.dog.Dog <./tests/samples/dog
{
  "breed": "gsd",
  "age": 3,
  "temperament": "excited"
}

Use PROTOC and PROTOC_INCLUDE to control the executed protoc binary and configure the -I=/proto/path argument (design copied from prost).

To set up, put your *.fdset files in ~/.pq, /etc/pq, or a different directory specified with the FDSET_PATH env var:

$ protoc -o dog.fdset dog.proto
$ protoc -o person.fdset person.proto
$ cp *.fdset ~/.pq/

You can specify additional fdset directories or files via options:

$ pq --msgtype com.example.dog.Dog --fdsetdir ./tests/fdsets <./tests/samples/dog
$ pq --msgtype com.example.dog.Dog --fdsetfile ./tests/fdsets/dog.fdset <./tests/samples/dog

Pipe a single compiled protobuf message:

$ pq --msgtype com.example.dog.Dog <./tests/samples/dog
{
  "age": 4,
  "breed": "poodle",
  "temperament": "excited"
}

Pipe a varint or leb128 delimited stream:

$ pq --msgtype com.example.dog.Dog --stream varint <./tests/samples/dog_stream
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Consume from a Kafka stream:

$ pq kafka my_topic --brokers 192.168.0.1:9092 --beginning --count 1 --msgtype com.example.dog.Dog
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Convert a Kafka stream to varint-delimited:

$ pq kafka my_topic --brokers=192.168.0.1:9092 --count 1 --convert varint |\
> pq --msgtype com.example.dog.Dog --stream varint
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Pipe kafkacat output to it:

$ kafkacat -b 192.168.0.1:9092 -C -u -q -f "%R%s" -t my_topic |\
> pq --msgtype=com.example.dog.Dog --stream i32be
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Compile without kafka

To compile pq without kafka support, run:

$ cargo build --no-default-features

Compile for Windows

  1. Install Visual Studio Installer Community edition
  2. Run the installer and install Visual Studio Build Tools 2019. You need the C++ Build Tools workload. Note that you can't just install the minimal package, you also need MSVC C++ x64/86 Build Tools and Windows 10 SDK.
  3. Open x64 Native Tools Command Prompt from the start menu.
  4. Download and run rustup-init.exe
  5. Close and reopen your terminal (so cargo will be in your path)
  6. Run cargo install --no-default-features pq

Note that this will disable the Kafka feature, which is not currently supported on Windows.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].