grpc

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

README

GRPC Broker

The grpc broker is a point to point grpc broker.

Overview

This broker is like the built in go-micro http2 broker except it uses grpc and protobuf as the protocol and messaging format. It uses the go-micro registry to subscribe to a topic, creating a service for that topic. Publishers lookup the registry for subscribers and publish to them, hence point to point.

Usage

import (
	"github.com/micro/go-plugins/broker/grpc"
)

// create and connect (starts a grpc server)
b := grpc.NewBroker()
b.Init()
b.Connect()

// subscribe
sub, _ := b.Subscribe("events")
defer sub.Unsubscribe()

// publish
b.Publish("events", &broker.Message{
	Headers: map[string]string{"type": "event"},
	Body: []byte(`an event`),
})

Documentation

Overview

Package grpc is a point to point grpc broker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(opts ...broker.Option) broker.Broker

NewBroker returns a new grpc broker

Types

This section is empty.

Directories

Path Synopsis
Package broker is a generated protocol buffer package.
Package broker is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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