66 lines
1.9 KiB
Go
66 lines
1.9 KiB
Go
// Package rules defines Temporal stuff
|
|
package rules
|
|
|
|
import (
|
|
"time"
|
|
|
|
"code.tnxs.net/taxnexus/lib/api/crm/crm_client"
|
|
"code.tnxs.net/taxnexus/lib/api/devops/devops_client"
|
|
"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"
|
|
const backoffCoefficient = 2.0
|
|
const getTimeout = 6 * time.Minute
|
|
const heartbeatTimeout = 0
|
|
const initialInterval = time.Second
|
|
const maximumAttempts = 50
|
|
const maximumInterval = time.Minute
|
|
const postTimeout = 6 * time.Minute
|
|
const scheduleToCloseTimeout = 0
|
|
const scheduleToStartTimeout = 0
|
|
const startToCloseTimeout = time.Minute
|
|
const waitForCancelation = false
|
|
|
|
var sugar = logger.New(zapcore.DebugLevel)
|
|
|
|
var crmClient = crm_client.Default
|
|
var devopsClient = devops_client.Default
|
|
var opsClient = ops_client.Default
|
|
var workflowClient = workflow_client.Default
|
|
|
|
// 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"
|
|
|
|
// 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
|
|
}
|