Пример #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);
     }
 }
Пример #2
0
 /**
  * Creates a builder to copy the stream configuration.
  * @param jetStreamConfig an existing NATSJetStreamConfig
  * @return a stream configuration builder
  */
 public static JetStreamConfigBuilder Builder(JetStreamConfig jetStreamConfig)
 {
     return(new JetStreamConfigBuilder(jetStreamConfig));
 }