Removed clientID from NATS-Streaming Config (#6391)

clientID must be a unique `UUID` for each connections. Now, the
server generates it, rather considering the config.

Removing it as it is non-beneficial right now.

Fixes #6364
This commit is contained in:
Praveen raj Mani
2018-11-30 10:46:17 +05:30
committed by Nitish Tiwari
parent e7971b1d55
commit e7af31c2ff
9 changed files with 93 additions and 22 deletions

View File

@@ -40,7 +40,6 @@ type NATSArgs struct {
Streaming struct {
Enable bool `json:"enable"`
ClusterID string `json:"clusterID"`
ClientID string `json:"clientID"`
Async bool `json:"async"`
MaxPubAcksInflight int `json:"maxPubAcksInflight"`
} `json:"streaming"`
@@ -64,9 +63,6 @@ func (n NATSArgs) Validate() error {
if n.Streaming.ClusterID == "" {
return errors.New("empty cluster id")
}
if n.Streaming.ClientID == "" {
return errors.New("empty client id")
}
}
return nil
@@ -128,6 +124,7 @@ func (target *NATSTarget) Close() (err error) {
func NewNATSTarget(id string, args NATSArgs) (*NATSTarget, error) {
var natsConn *nats.Conn
var stanConn stan.Conn
var clientID string
var err error
if args.Streaming.Enable {
@@ -137,12 +134,9 @@ func NewNATSTarget(id string, args NATSArgs) (*NATSTarget, error) {
}
addressURL := scheme + "://" + args.Username + ":" + args.Password + "@" + args.Address.String()
clientID := args.Streaming.ClientID
if clientID == "" {
clientID, err = getNewUUID()
if err != nil {
return nil, err
}
clientID, err = getNewUUID()
if err != nil {
return nil, err
}
connOpts := []stan.Option{stan.NatsURL(addressURL)}