49 lines
1.3 KiB
Go
49 lines
1.3 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/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 getTimeout = 6 * time.Minute
|
|
// const dateTimeFormat = "2006-01-02T15:04:05-0800"
|
|
const postTimeout = 6 * time.Minute
|
|
|
|
var sugar = logger.New(zapcore.InfoLevel)
|
|
|
|
var crmClient = crm_client.Default
|
|
var opsClient = ops_client.Default
|
|
var workflowClient = workflow_client.Default
|
|
|
|
// NewLeadWorkflowID is the text identifier for new-lead-workflow
|
|
const NewLeadWorkflowID = "new-lead-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
|
|
}
|