func (c *Controller) Invoke(topic string, invocation *types2.OpenFaaSInvocation) error {
	functions := c.cache.GetCachedValues(topic)
	for _, fn := range functions {
		_, err := c.client.InvokeSync(context.Background(), fn, invocation)
		if err != nil {
			log.Printf("Invocation for topic %s failed due to err %s", topic, err)
			return err
		}
	}
	log.Printf("Invocation for topic %s finished on %d function(s)", topic, len(functions))
	return nil
}
Invoke triggers a call to all functions registered to the specified topic. It will abort invocation in case it encounters an error
package openfaas
import (
	"context"
	"fmt"
	"log"
	"strings"
	"time"
	types2 "github.com/Templum/rabbitmq-connector/pkg/types"
	"github.com/Templum/rabbitmq-connector/pkg/config"
	"github.com/openfaas/faas-provider/types"
)
type Controller struct {
	conf   *config.Controller
	client FunctionCrawler
	cache  TopicMap
}
func NewController(conf *config.Controller, client FunctionCrawler, cache TopicMap) *Controller {
	return &Controller{
		conf:   conf,
		client: client,
		cache:  cache,
	}
}
func (c *Controller) Start(ctx context.Context) {
	hasNamespaceSupport, _ := c.client.HasNamespaceSupport(ctx)
	timer := time.NewTicker(c.conf.TopicRefreshTime)
	c.refreshTick(ctx, hasNamespaceSupport)
	go c.refresh(ctx, timer, hasNamespaceSupport)
}