mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Vendor new queue-worker version
Introduces 0.4.6 of queue-worker - see upstream repo for changes. Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
17
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/handler.go
generated
vendored
17
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/handler.go
generated
vendored
@ -15,15 +15,26 @@ type NatsQueue struct {
|
||||
nc stan.Conn
|
||||
}
|
||||
|
||||
type NatsConfig interface {
|
||||
GetClientID() string
|
||||
}
|
||||
|
||||
type DefaultNatsConfig struct {
|
||||
}
|
||||
|
||||
func (DefaultNatsConfig) GetClientID() string {
|
||||
val, _ := os.Hostname()
|
||||
return "faas-publisher-" + val
|
||||
}
|
||||
|
||||
// CreateNatsQueue ready for asynchronous processing
|
||||
func CreateNatsQueue(address string, port int) (*NatsQueue, error) {
|
||||
func CreateNatsQueue(address string, port int, clientConfig NatsConfig) (*NatsQueue, error) {
|
||||
queue1 := NatsQueue{}
|
||||
var err error
|
||||
natsURL := fmt.Sprintf("nats://%s:%d", address, port)
|
||||
log.Printf("Opening connection to %s\n", natsURL)
|
||||
|
||||
val, _ := os.Hostname()
|
||||
clientID := "faas-publisher-" + val
|
||||
clientID := clientConfig.GetClientID()
|
||||
clusterID := "faas-cluster"
|
||||
|
||||
nc, err := stan.Connect(clusterID, clientID, stan.NatsURL(natsURL))
|
||||
|
Reference in New Issue
Block a user