Update to use actual values passed through the chain
This commit is contained in:
parent
ef8303f11f
commit
4b18b779aa
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/micro/go-micro/client"
|
"github.com/micro/go-micro/client"
|
||||||
"github.com/micro/go-micro/cmd"
|
"github.com/micro/go-micro/cmd"
|
||||||
@ -35,11 +34,7 @@ func pub(i int) {
|
|||||||
func main() {
|
func main() {
|
||||||
cmd.Init()
|
cmd.Init()
|
||||||
fmt.Println("\n--- Publisher example ---\n")
|
fmt.Println("\n--- Publisher example ---\n")
|
||||||
// for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
i := 0
|
|
||||||
for {
|
|
||||||
pub(i)
|
pub(i)
|
||||||
i++
|
|
||||||
time.Sleep(time.Millisecond * 5)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
|
|||||||
|
|
||||||
if !mtype.stream {
|
if !mtype.stream {
|
||||||
fn := func(ctx context.Context, req interface{}, rsp interface{}) error {
|
fn := func(ctx context.Context, req interface{}, rsp interface{}) error {
|
||||||
returnValues = function.Call([]reflect.Value{s.rcvr, mtype.prepareContext(ctx), argv, replyv})
|
returnValues = function.Call([]reflect.Value{s.rcvr, mtype.prepareContext(ctx), reflect.ValueOf(req), reflect.ValueOf(rsp)})
|
||||||
|
|
||||||
// The return value for the method is an error.
|
// The return value for the method is an error.
|
||||||
if err := returnValues[0].Interface(); err != nil {
|
if err := returnValues[0].Interface(); err != nil {
|
||||||
@ -300,7 +300,7 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
|
|||||||
|
|
||||||
// Invoke the method, providing a new value for the reply.
|
// Invoke the method, providing a new value for the reply.
|
||||||
fn := func(ctx context.Context, req interface{}, rspFn interface{}) error {
|
fn := func(ctx context.Context, req interface{}, rspFn interface{}) error {
|
||||||
returnValues = function.Call([]reflect.Value{s.rcvr, mtype.prepareContext(ctx), argv, reflect.ValueOf(sendReply)})
|
returnValues = function.Call([]reflect.Value{s.rcvr, mtype.prepareContext(ctx), reflect.ValueOf(req), reflect.ValueOf(rspFn)})
|
||||||
if err := returnValues[0].Interface(); err != nil {
|
if err := returnValues[0].Interface(); err != nil {
|
||||||
// the function returned an error, we use that
|
// the function returned an error, we use that
|
||||||
return err.(error)
|
return err.(error)
|
||||||
|
Loading…
Reference in New Issue
Block a user