Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Env = []templates.Environment{
{Name: "BabexAddr", Type: "string", Env: "BABEX_ADDR", Default: "amqp://guest:guest@localhost:5672/"},
{Name: "BabexExchange", Type: "string", Env: "BABEX_EXCHANGE"},
{Name: "BabexName", Type: "string", Env: "BABEX_NAME"},
}
View Source
var Libs = []templates.Library{
{Name: "github.com/matroskin13/babex"},
}
View Source
var Models = map[string]string{}
View Source
var Props = []templates.Property{
{Name: "Service", Type: "*babex.Service"},
}
View Source
var TemplateRunFunction = `` /* 137-byte string literal not displayed */
View Source
var TemplateSetter = `
if err = app.setBabex(); err != nil {
logger.Fatal("cannot create Babex node", zap.Error(err))
return nil, err
}`
View Source
var TemplateSetterFunction = `` /* 424-byte string literal not displayed */
View Source
var Templates = map[string]string{
"app/babex.go": `package app
import (
"github.com/matroskin13/babex"
"go.uber.org/zap"
)
func (a *Application) RunBabex() error {
msgs, err := a.Service.GetMessages()
if err != nil {
a.Logger.Fatal("cannot get messages", zap.Error(err))
return err
}
errs := a.Service.GetErrors()
a.Logger.Info("service listen queue")
go func() {
for {
select {
case msg := <-msgs:
err := a.receive(msg)
if err != nil {
a.Logger.Error("error on processing message", zap.Error(err))
}
case err := <-errs:
a.Error <- err
}
}
}()
return nil
}
func (a *Application) receive(msg *babex.Message) (err error) {
//region Implementation
//TODO: Implement me
//endregion
//region Next
err = a.Service.Next(msg, msg.Data, nil)
if err != nil && err != babex.ErrorNextIsNotDefined {
a.Logger.Error("cannot next", zap.Error(err))
return err
}
//endregion
return nil
}
`,
}
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.