micro / plugins

Go Micro plugins
Apache License 2.0
96 stars 92 forks source link

feat: add rabbitmq.PublishDeliveryMode, a client.PublishOption for setting message delivery mode #126

Closed quexer closed 10 months ago

quexer commented 11 months ago

Event.Publish accept client.PublishOption, so I add a new client.PublishOption to set message delivery mode.

It has the same functionality with rabbitmq.DeliveryMode(), but as a client.PublishOption

// Event is used to publish messages to a topic.
type Event interface {
  // Publish publishes a message to the event topic
  Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error
}

usage:

...

publisher := micro.NewEvent(topic, microClient).
opt := rabbitmq.PublishDeliveryMode(2)

publisher.Publish(ctx, msg, opt)

...
quexer commented 11 months ago

@jochumdev could you pls review and merge this pr ? thanks