qrpc

module
v0.0.0-...-2e1ad0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2020 License: MIT

README

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

Usage is the same as original protoc-gen-go. See 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/NightWolf007/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.

Directories

Path Synopsis
cmd
examples
pb
internal
protoc-gen-go/qrpc
Package qrpc outputs qRPC service descriptions in Go code.
Package qrpc outputs qRPC service descriptions in Go code.
pkg
drivers/kafka
Package kafka implements Apache Kafka driver for qRPC
Package kafka implements Apache Kafka driver for qRPC
qrpc
Package qrpc provides qRPC implementation
Package qrpc provides qRPC implementation
test
pb

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL