Skip to content

Message Broker / queues plugin for Go Catupiry Framework

Notifications You must be signed in to change notification settings

go-catupiry/msgbroker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Message Broker / queues for Go Catupiry Framework

Congiguration

NSQ:

  • NSQ_ADDR "127.0.0.1:4150"
  • NSQ_LOOKUPD_ADDR "127.0.0.1:4161"

RabbitMQ

Usage

With nsq services

main.go

package main

import (
	"fmt"
	"os"

	"github.com/go-catupiry/catu"
	"github.com/sirupsen/logrus"
	"gitlab.com/www.monitordomercado.com.br/mm/msgbroker"
	"gitlab.com/www.monitordomercado.com.br/mm/msgbroker_nsq"

)

func main() {
	logrus.Debug("Starting main")

	var err error

	app := catu.Init()

  // Register the NSQ plugin to load its feature in the app
	app.RegisterPlugin(msgbroker.NewPlugin(&msgbroker.PluginCfgs{
		Client: msgbroker_nsq.NewNSQClient(&msgbroker_nsq.NSQClientCfg{}),
	}))
	app.RegisterPlugin(project.NewPlugin(&project.PluginCfgs{}))

	err = app.Bootstrap()
	handleExecutionError(err)

	cmd.Execute()

	handleExecutionError(nil)
}

func handleExecutionError(err error) {
	if err != nil {
		logrus.WithFields(logrus.Fields{
			"error": fmt.Sprintf("%+v\n", err),
		}).Error("main handleExecutionError")
		os.Exit(1)
	}
}

TODO!

  • add tests

About

Message Broker / queues plugin for Go Catupiry Framework

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages