micro/publisher.go

17 lines
298 B
Go
Raw Normal View History

2017-03-18 19:00:11 +00:00
package micro
import (
2018-03-03 11:53:52 +00:00
"context"
2017-03-18 19:00:11 +00:00
"github.com/micro/go-micro/client"
)
type publisher struct {
c client.Client
topic string
}
func (p *publisher) Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error {
2018-04-14 18:15:09 +01:00
return p.c.Publish(ctx, p.c.NewMessage(p.topic, msg))
2017-03-18 19:00:11 +00:00
}