/** * 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); } }
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; }
/** * sets the idle heart beat wait time * @param idleHeartbeat the idle heart beat duration * @return Builder */ public ConsumerConfigBuilder SetHeartbeat(TimeSpan heartbeat) { this.Heartbeat = NATSJetStreamDuration.OfSeconds(((long)heartbeat.TotalSeconds)).Nanos; return(this); }
/** * Sets the acknowledgement wait duration of the ConsumerConfiguration. * @param timeout the wait timeout * @return Builder */ public ConsumerConfigBuilder SetAckWait(TimeSpan timeout) { this.AckWait = NATSJetStreamDuration.OfSeconds(((long)timeout.TotalSeconds)).Nanos; return(this); }