Skip to content

cashwagon/qrpc

Repository files navigation

qRPC

Asynchronous protobuf based protocol. It behaves like gRPC, but the RPC calls are going through message broker queue.

This project includes qRPC generator and Go library.

Generator

qRPC provides custom protoc-gen-go extended with qRPC plugin.

Installation

To use this software, you must:

Important: You need to override original protoc-gen-go.

Usage

How to use protoc-gen-go https://github.com/golang/protobuf/blob/master/README.md#using-protocol-buffers-with-go

To generate code compatible with qRPC pass the plugins parameter to protoc-gen-go:

protoc --go_out=plugins=qrpc:. *.proto

Library

The qRPC library uses abstract interfaces for drivers. So you can write your own driver to support custom message broker and pass it qRPC.

For now the only supported drivers for:

Installation

To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run:

go get -u github.com/cashwagon/qrpc/pkg/qrpc

Usage

See examples directory for examples.

Development

Requirements

Usage

Before runnings examples or tests you need to setup KAFKA_BROKERS environment variable:

export KAFKA_BROKERS="kafka:9092"

First project setup

dip provision

Check installation

dip make lint
dip make test

Build

dip make

Generate protobuf files

dip make generate

Connect to postgresql shell

dip psql

List of supported commands

dip ls

Integrate dip into your shell

eval "$(dip console)"

Close (down) project

dip down

Services

Kafka Manager

Host: http://localhost:9000

Manages local Kafka cluster. You need to setup cluster in kafka-manager for the first time:

Cluster -> Add Cluster

Cluster Name: local
Cluster Zookeeper Hosts: zookeeper:2181
Kafka Version: 2.2.0
Enable JMX Polling: Yes
Poll consumer information: Yes

Save

Kafdrop

Host: http://localhost:9001

Allows to view and read topics from Kafka.

VSCode

Project supports VSCode remote containers.

To start development with VSCode run dip provision for the first time. Then just run command Remote-Containers: Open Folder in Container... in VSCode and select the project folder.