add NATS JetStream support (#15201)

This commit is contained in:
Harshavardhana
2022-07-06 13:29:08 -07:00
committed by GitHub
parent 3af6073576
commit dd839bf295
5 changed files with 91 additions and 33 deletions

View File

@@ -479,30 +479,6 @@ var (
Optional: true,
Type: "duration",
},
config.HelpKV{
Key: target.NATSStreaming,
Description: "set to 'on', to use streaming NATS server",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingAsync,
Description: "set to 'on', to enable asynchronous publish",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingMaxPubAcksInFlight,
Description: "number of messages to publish without waiting for ACKs",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.NATSStreamingClusterID,
Description: "unique ID for NATS streaming cluster",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSCertAuthority,
Description: "path to certificate chain of the target NATS server",
@@ -524,6 +500,12 @@ var (
Type: "string",
Sensitive: true,
},
config.HelpKV{
Key: target.NATSJetStream,
Description: "enable JetStream support",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSQueueDir,
Description: queueDirComment,
@@ -536,6 +518,30 @@ var (
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.NATSStreaming,
Description: "[DEPRECATED] set to 'on', to use streaming NATS server",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingAsync,
Description: "[DEPRECATED] set to 'on', to enable asynchronous publish",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingMaxPubAcksInFlight,
Description: "[DEPRECATED] number of messages to publish without waiting for ACKs",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.NATSStreamingClusterID,
Description: "[DEPRECATED] unique ID for NATS streaming cluster",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: config.Comment,
Description: config.DefaultComment,

View File

@@ -949,6 +949,10 @@ var (
Key: target.NATSPingInterval,
Value: "0",
},
config.KV{
Key: target.NATSJetStream,
Value: config.EnableOff,
},
config.KV{
Key: target.NATSStreaming,
Value: config.EnableOff,
@@ -1073,6 +1077,11 @@ func GetNotifyNATS(natsKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[s
clientKeyEnv = clientKeyEnv + config.Default + k
}
jetStreamEnableEnv := target.EnvNATSJetStream
if k != config.Default {
jetStreamEnableEnv = jetStreamEnableEnv + config.Default + k
}
natsArgs := target.NATSArgs{
Enable: true,
Address: *address,
@@ -1090,6 +1099,7 @@ func GetNotifyNATS(natsKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[s
QueueLimit: queueLimit,
RootCAs: rootCAs,
}
natsArgs.JetStream.Enable = env.Get(jetStreamEnableEnv, kv.Get(target.NATSJetStream)) == config.EnableOn
streamingEnableEnv := target.EnvNATSStreaming
if k != config.Default {