Beispiel #1
0
 /**
  * Update Builder, useful if you need to update a configuration
  * @param sc the configuration to copy
  */
 internal JetStreamConfigBuilder(JetStreamConfig jetStreamConfig)
 {
     if (jetStreamConfig != null)
     {
         Name = jetStreamConfig.Name;
         SetSubjects(jetStreamConfig.Subjects);
         this.RetentionPolicy = jetStreamConfig.RetentionPolicy;
         this.MaxConsumers    = jetStreamConfig.MaxConsumers;
         this.MaxMsgs         = jetStreamConfig.MaxMsgs;
         this.MaxBytes        = jetStreamConfig.MaxBytes;
         this.MaxAge          = TimeSpan.FromMilliseconds(NATSJetStreamDuration.OfNanos(jetStreamConfig.MaxAge).Millis);
         this.MaxMsgSize      = jetStreamConfig.MaxMsgSize;
         this.StorageType     = jetStreamConfig.StorageType;
         this.Replicas        = jetStreamConfig.Replicas;
         this.NoAck           = jetStreamConfig.NoAck;
         this.TemplateOwner   = jetStreamConfig.TemplateOwner;
         this.DiscardPolicy   = jetStreamConfig.DiscardPolicy;
         if (jetStreamConfig.DuplicateWindow.HasValue)
         {
             this.DuplicateWindow = TimeSpan.FromMilliseconds(NATSJetStreamDuration.OfNanos(jetStreamConfig.DuplicateWindow.Value).Millis);
         }
         this.Placement = jetStreamConfig.Placement;
         this.Mirror    = jetStreamConfig.Mirror;
         SetSources(jetStreamConfig.Sources);
     }
 }
Beispiel #2
0
 private JetStreamConfig(
     string name,
     List <string> subjects,
     RetentionPolicy retentionPolicy,
     long maxConsumers,
     long maxMsgs,
     long maxBytes,
     TimeSpan maxAge,
     long maxMsgSize,
     StorageType storageType,
     int replicas,
     bool noAck,
     string templateOwner,
     DiscardPolicy discardPolicy,
     TimeSpan?duplicateWindow,
     Placement placement,
     StreamSource mirror,
     List <StreamSource> sources)
 {
     this.Name            = name;
     this.Subjects        = subjects;
     this.RetentionPolicy = retentionPolicy;
     this.MaxConsumers    = maxConsumers;
     this.MaxMsgs         = maxMsgs;
     this.MaxBytes        = maxBytes;
     this.MaxAge          = NATSJetStreamDuration.OfMillis(((long)maxAge.TotalMilliseconds)).Nanos;
     this.MaxMsgSize      = maxMsgSize;
     this.StorageType     = storageType;
     this.Replicas        = replicas;
     this.NoAck           = noAck;
     this.TemplateOwner   = templateOwner;
     this.DiscardPolicy   = discardPolicy;
     if (duplicateWindow.HasValue)
     {
         this.DuplicateWindow = NATSJetStreamDuration.OfMillis(((long)duplicateWindow.Value.TotalMilliseconds)).Nanos;
     }
     this.Placement = placement;
     this.Mirror    = mirror;
     this.Sources   = sources;
 }
Beispiel #3
0
 /**
  * Sets the mirror  object
  * @param mirror the mirror object
  * @return Builder
  */
 public JetStreamConfigBuilder SetMirror(StreamSource mirror)
 {
     this.Mirror = mirror;
     return(this);
 }