Exemplo n.º 1
0
func TestClientSuite_RabbitTransport(t *testing.T) {
	suite.Run(t, &clientSuite{
		TransF: func() transport.Transport {
			return rabbit.NewTransport()
		},
	})
}
Exemplo n.º 2
0
func TestServerSuite_RabbitTransport(t *testing.T) {
	suite.Run(t, &serverSuite{
		TransF: func() transport.Transport {
			return rabbit.NewTransport()
		},
	})
}
Exemplo n.º 3
0
func main() {
	s := service.Init(service.Config{
		Name:      "foo",
		Transport: rabbit.NewTransport(),
	})

	s.Server().AddEndpoints(server.Endpoint{
		Name:     "Say.Hello",
		Handler:  handler,
		Request:  new(hello.Request),
		Response: new(hello.Response),
	})

	s.Run()
}
Exemplo n.º 4
0
func main() {
	req := mercury.NewRequest()
	req.SetService("foo")
	req.SetEndpoint("Say.Hello")
	req.SetBody(&hello.Request{
		Name: "John",
	})
	tmsg.ProtoMarshaler().MarshalBody(req)
	trans := rabbit.NewTransport()
	rsp, err := trans.Send(req, time.Second)
	if err != nil {
		fmt.Println(err)
		return
	}
	tmsg.ProtoUnmarshaler(new(hello.Response)).UnmarshalPayload(rsp)

	fmt.Println(rsp.Body())
}