tree: 529c02f84664bc813ed493729a66e7513d20de60 [path history] [tgz]
  1. conf/
  2. loadbalancer/
  3. proto/
  4. api.go
  5. client.go
  6. client_test.go
  7. consts.go
  8. consumer.go
  9. dispatcher.go
  10. dispatcher_test.go
  11. fake_grpcserver.go
  12. fake_webhookserver.go
  13. heartbeat.go
  14. heartbeat_test.go
  15. msg.go
  16. option.go
  17. producer.go
  18. protocol_type.go
  19. README.md
eventmesh-sdk-go/grpc/README.md

grpc

grpc client for evenemesh, support multiple type of loadbalancer

how to use

send message

subscribe message

setup with option

1. setup the logger

if you want to rewrite the log to other place, such as some promethus and so on, you need to implements the log.Logger interface, and set it with GRPCOption for example:

type selfLogger struct{
}

func (s *selfLogger) Infof(template string, args ...interface{}) {
	// todo
}
// ...
// other methods

cli, err := grpc.New(&conf.GRPCConfig{}, []Option{WithLogger(&selfLogger{})})

2. setup the idgen

in grpc client, we provide two kinds of id generator, uuid/flake, you can refers to commom/id for details. and if you want to implement it yourself, just implement the id.Interface api, for example:

type selfIdg struct{}
func (s* selfIdg) Next() string {
	return "uniq id"
}

cli, err := grpc.New(&conf.GRPCConfig{}, []Option{WithID(&selfIdg{})})

TODO

use etcd as service discovery