mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-22 19:19:18 -05:00
Bump reva to get latest changes for LDAP client
This commit is contained in:
+10
@@ -112,6 +112,16 @@ func (s *stream) Publish(topic string, msg interface{}, opts ...events.PublishOp
|
||||
}
|
||||
|
||||
// publish the event to the topic's channel
|
||||
// publish synchronously if configured
|
||||
if s.opts.SyncPublish {
|
||||
_, err := s.natsJetStreamCtx.Publish(event.Topic, bytes)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "Error publishing message to topic")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// publish asynchronously by default
|
||||
if _, err := s.natsJetStreamCtx.PublishAsync(event.Topic, bytes); err != nil {
|
||||
return errors.Wrap(err, "Error publishing message to topic")
|
||||
}
|
||||
|
||||
+13
-5
@@ -8,11 +8,12 @@ import (
|
||||
|
||||
// Options which are used to configure the nats stream.
|
||||
type Options struct {
|
||||
ClusterID string
|
||||
ClientID string
|
||||
Address string
|
||||
TLSConfig *tls.Config
|
||||
Logger logger.Logger
|
||||
ClusterID string
|
||||
ClientID string
|
||||
Address string
|
||||
TLSConfig *tls.Config
|
||||
Logger logger.Logger
|
||||
SyncPublish bool
|
||||
}
|
||||
|
||||
// Option is a function which configures options.
|
||||
@@ -52,3 +53,10 @@ func Logger(log logger.Logger) Option {
|
||||
o.Logger = log
|
||||
}
|
||||
}
|
||||
|
||||
// SynchronousPublish allows using a synchronous publishing instead of the default asynchronous
|
||||
func SynchronousPublish(sync bool) Option {
|
||||
return func(o *Options) {
|
||||
o.SyncPublish = sync
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user