gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/publisher.go (about)

     1  package micro
     2  
     3  import (
     4  	"context"
     5  
     6  	"gitee.com/liuxuezhan/go-micro-v1.18.0/client"
     7  )
     8  
     9  type publisher struct {
    10  	c     client.Client
    11  	topic string
    12  }
    13  
    14  func (p *publisher) Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error {
    15  	return p.c.Publish(ctx, p.c.NewMessage(p.topic, msg), opts...)
    16  }