Documentation ¶
Index ¶
- Variables
- func NewClient(opts *client.Options) (client.Client, error)
- func NewNamespaceClient(opts *client.Options) (client.NamespaceClient, error)
- func NewWorker(client client.Client, taskQueue string, options worker.Options) worker.Worker
- func WithClientOptions(option *client.Options) func(*TransactionManager)
- func WithInstrumentationClient(telemetry *instrumentation.Client) func(*TransactionManager)
- func WithLogger(logger *zap.Logger) func(*TransactionManager)
- func WithMessageQueueClient(client *msq.Client) func(*TransactionManager)
- func WithMetricsEnabled(enabled bool) func(*TransactionManager)
- func WithMongo(mongoConn *mongo.Client) func(*TransactionManager)
- func WithPostgres(postgres *postgres.Client) func(*TransactionManager)
- func WithRetryPolicy(policy *Policy) func(*TransactionManager)
- func WithRpcTimeout(timeout time.Duration) func(*TransactionManager)
- type Option
- type Policy
- type TransactionManager
- type WorkflowManager
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidClientOptions = fmt.Errorf("invalid input argument. client options cannot be null") ErrInvalidTransactionManagerConfig = fmt.Errorf("invalid input argument. transaction manager config cannot be nil") ErrInvalidLogger = fmt.Errorf("invalid logger. logger cannot be nil") ErrInvalidTelemetrySDK = fmt.Errorf("invalid telemetry sdk config. config cannot be nil") ErrNilAccount = fmt.Errorf("account cannot be nil") ErrNilOldEmail = fmt.Errorf("old email cannot be nil") ErrInvalidUpdateAccountWorkflowRequest = fmt.Errorf("invalid update account workflow request. request cannot be nil or invalid") ErrInvalidRetryPolicy = fmt.Errorf("invalid input argument. retry policy cannot be nil or invalid") ErrInvalidRpcTimeout = fmt.Errorf("invalid input argument. rpc timeout cannot be nil or invalid") ErrInvalidConfigurations = fmt.Errorf("invalid input argument. transaction manager configurations cannot be nil or invalid") )
Functions ¶
func NewNamespaceClient ¶
func NewNamespaceClient(opts *client.Options) (client.NamespaceClient, error)
NewNamespaceClient creates an instance of a namespace client, to manage lifecycle of namespaces.
func WithClientOptions ¶
func WithClientOptions(option *client.Options) func(*TransactionManager)
WithClientOptions defines the options to use when connecting to the database
func WithInstrumentationClient ¶
func WithInstrumentationClient(telemetry *instrumentation.Client) func(*TransactionManager)
The function returns a function that takes a TransactionManager pointer and sets its instrumentation client to the provided one.
func WithLogger ¶
func WithLogger(logger *zap.Logger) func(*TransactionManager)
The function returns a function that takes a TransactionManager pointer and sets its logger to the provided zap logger.
func WithMessageQueueClient ¶
func WithMessageQueueClient(client *msq.Client) func(*TransactionManager)
This function returns a function that takes a TransactionManager pointer and sets its message queue client to the provided client.
func WithMetricsEnabled ¶
func WithMetricsEnabled(enabled bool) func(*TransactionManager)
The function returns a function that takes a TransactionManager pointer and enables or disables metrics based on a boolean input.
func WithMongo ¶
func WithMongo(mongoConn *mongo.Client) func(*TransactionManager)
The function returns a closure that takes a TransactionManager pointer and sets its mongoConn field to the provided mongo.Client pointer.
func WithPostgres ¶
func WithPostgres(postgres *postgres.Client) func(*TransactionManager)
The function returns a function that takes a TransactionManager pointer and sets its Postgres client field to the provided client.
func WithRetryPolicy ¶
func WithRetryPolicy(policy *Policy) func(*TransactionManager)
The function returns a function that takes a TransactionManager and sets its retry policy to the provided policy.
func WithRpcTimeout ¶
func WithRpcTimeout(timeout time.Duration) func(*TransactionManager)
The function returns a function that takes a TransactionManager pointer and sets its RPC timeout to the specified duration.
Types ¶
type Option ¶
type Option = func(*TransactionManager)
Option is a function that takes a TransactionManager pointer and sets some option on it
type Policy ¶
type Policy struct { RetryInitialInterval *time.Duration RetryBackoffCoefficient float64 MaximumInterval time.Duration MaximumAttempts int }
Policy outlines retry policies necessary for workflow and downstream service calls
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
`TransactionManager` is the single struct by which we manage and initiate all distributed transactions within the service. It provides wrapper facilities around the temporal sdk client as well in order to properly emit metrics and traces during rpc operations
@property client - This is the client used to interact with a remote temporal cluster. @property TelemetrySDK - This is the telemetry SDK that we use to send telemetry data to newrelic @property Logger - This is the logger that will be used to log messages. @property AuthenticationServiceClient - This is the gRPC client for the Authentication Service. @property FinancialIntegrationServiceClient - This is the gRPC client for the Financial Integration Service. @property SocialServiceClient - This is the client for the Social Service. @property MessageQueueSDK - This is the message queue SDK that we will use to send messages to the queue. @property DatabaseConn - This is the database connection object that we will use to connect to the database.
func NewTransactionManager ¶
func NewTransactionManager(options ...Option) (*TransactionManager, error)
It creates a new instance of the TransactionManager struct and returns it
func (*TransactionManager) Close ¶
func (t *TransactionManager) Close()
Close closes the client and all its underlying connections and clears up any associated reasources
func (*TransactionManager) Start ¶
func (tx *TransactionManager) Start()
Start enables the worker to start listening to a given task queue NOTE: This should be ran in a go routine otherwise the process will block
type WorkflowManager ¶
type WorkflowManager interface { Close() Start() }