Allow for customizing the name of the target NATS Streaming cluster.

Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
This commit is contained in:
Bruno Miguel Custódio
2019-11-25 10:40:37 +00:00
committed by Alex Ellis
parent ff5ec39e4d
commit 365f459b3f
7 changed files with 49 additions and 10 deletions

View File

@ -7,17 +7,16 @@ import (
)
// CreateNATSQueue ready for asynchronous processing
func CreateNATSQueue(address string, port int, clientConfig NATSConfig) (*NATSQueue, error) {
func CreateNATSQueue(address string, port int, clusterName string, clientConfig NATSConfig) (*NATSQueue, error) {
var err error
natsURL := fmt.Sprintf("nats://%s:%d", address, port)
log.Printf("Opening connection to %s\n", natsURL)
clientID := clientConfig.GetClientID()
clusterID := "faas-cluster"
queue1 := NATSQueue{
ClientID: clientID,
ClusterID: clusterID,
ClusterID: clusterName,
NATSURL: natsURL,
Topic: "faas-request",
maxReconnect: clientConfig.GetMaxReconnect(),