printfcoder/stack-rpc-tutorials

How can integrate Broker kafka While Start Gateway

Haleluak opened this issue · 3 comments

I wonder is it possible if I start the API Gateway type Event Handler with Kafka?
The thing inside bracket pair [] in below code is what I did try but not success. Probably the cause of not importing the Kafka plugin but no idea how to do it.
micro [--broker=kafka] api --handler=event --namespace=go.micro.evt

The help is really appreciated.
Thanks.

Did you recompile micro with kafka plugin?

please follow the steps below:

  1. create a plugin.go file in the dir of micro:
package main
import (
     "github.com/micro/go-plugins/broker/kafka"
)
  1. recompile micro (github.com/micro/micro):
go build -o micro main.go plugin.go
  1. mv the micro binary file to $GOPATH/bin

step 2: when I recompile micro has issue
go: github.com/micro/go-plugins@v1.3.0 requires
k8s.io/api@v0.0.0-20190726022912-69e1bce1dad5 requires
github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9: invalid pseudo-version: revision is shorter than canonical (65acae22fc9d)
I use golang 1.13
Thanks

add the replace on your go.mod

replace (
	k8s.io/api => k8s.io/api v0.0.0-20191003035645-10e821c09743
	k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191003115452-c31ffd88d5d2
)

Probably it still doesn't work. but you can look for similar solutions by Google.