lib/rules/root.go

66 lines
1.9 KiB
Go
Raw Permalink 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"
// const dateTimeFormat = "2006-01-02T15:04:05-0800"
2021-01-21 17:28:52 +00:00
const backoffCoefficient = 2.0
const getTimeout = 6 * time.Minute
const heartbeatTimeout = 0
const initialInterval = time.Second
const maximumAttempts = 50
const maximumInterval = time.Minute
2021-01-13 02:41:43 +00:00
const postTimeout = 6 * time.Minute
2021-01-21 17:28:52 +00:00
const scheduleToCloseTimeout = 0
const scheduleToStartTimeout = 0
const startToCloseTimeout = time.Minute
const waitForCancelation = false
2021-01-13 02:41:43 +00:00
2021-01-20 01:44:51 +00:00
var sugar = logger.New(zapcore.DebugLevel)
2021-01-13 02:41:43 +00:00
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
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
}