lib/rules/root.go

62 lines
1.8 KiB
Go
Raw Normal View History

2021-01-13 02:41:43 +00:00
// Package rules defines Temporal stuff
package rules
import (
"time"
"code.tnxs.net/taxnexus/lib/api/crm/crm_client"
2021-01-18 03:13:54 +00:00
"code.tnxs.net/taxnexus/lib/api/devops/devops_client"
2021-01-13 02:41:43 +00:00
"code.tnxs.net/taxnexus/lib/api/ops/ops_client"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_client"
"code.tnxs.net/taxnexus/lib/app"
"code.tnxs.net/taxnexus/lib/app/logger"
temporal_client "go.temporal.io/sdk/client"
"go.uber.org/zap/zapcore"
)
// const dateFormat = "2006-01-02"
2021-01-18 03:13:54 +00:00
const getTimeout = 6 * time.Minute
2021-01-13 02:41:43 +00:00
// const dateTimeFormat = "2006-01-02T15:04:05-0800"
const postTimeout = 6 * time.Minute
2021-01-20 01:34:28 +00:00
const maxAttempts = 50
2021-01-13 02:41:43 +00:00
var sugar = logger.New(zapcore.InfoLevel)
var crmClient = crm_client.Default
2021-01-18 03:13:54 +00:00
var devopsClient = devops_client.Default
2021-01-13 02:41:43 +00:00
var opsClient = ops_client.Default
var workflowClient = workflow_client.Default
// NewLeadWorkflowID is the text identifier for new-lead-workflow
const NewLeadWorkflowID = "new-lead-workflow"
2021-01-19 02:57:04 +00:00
// NewDeveloperWorkflowID is the text identifier for new-developer-workflow
const NewDeveloperWorkflowID = "new-developer-workflow"
// NewIQWorkflowID is the text identifier for new-iq-workflow
const NewIQWorkflowID = "new-iq-workflow"
// NewAgentWorkflowID is the text identifier for new-iagentq-workflow
const NewAgentWorkflowID = "new-agent-workflow"
2021-01-13 02:41:43 +00:00
// TaxnexusRulesTaskQueueID defines the Temporal Task Queue used in the Temporal Worker
const TaxnexusRulesTaskQueueID = "TAXNEXUS_RULES_TASK_QUEUE"
// MyRules is the exported Temporal Client
var MyRules temporal_client.Client
// InitRules initializes the Temporal Client
func InitRules() error {
sugar = logger.New(app.GetLogLevel())
c, err := temporal_client.NewClient(
temporal_client.Options{
HostPort: "rules.noc.tnxs.net:7233",
})
if err != nil {
return err
}
MyRules = c
return nil
}