Documentation
¶
Index ¶
- type Context
- type ContextImpl
- func (c *ContextImpl) Complete(tc *TaskComplete) error
- func (c *ContextImpl) ExtendLock(id string, duration int) error
- func (c *ContextImpl) HandleBPMNError(code int, message string) error
- func (c *ContextImpl) HandleFailure(query TaskFailureRequest) error
- func (c *ContextImpl) Retries() int
- func (c *ContextImpl) StartLockExtender()
- func (c *ContextImpl) StopExtender()
- func (c *ContextImpl) TaskID() string
- func (c *ContextImpl) TopicName() string
- func (c *ContextImpl) Variables() camunda.Variables
- type Handler
- type Options
- type TaskComplete
- type TaskFailureRequest
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
Complete(tc *TaskComplete) error
HandleFailure(query TaskFailureRequest) error
HandleBPMNError(code int, message string) error
ExtendLock(id string, duration int) error
Variables() camunda.Variables
StartLockExtender()
StopExtender()
TaskID() string
TopicName() string
Retries() int
}
type ContextImpl ¶
type ContextImpl struct {
Task *camunda.ResLockedExternalTask
// contains filtered or unexported fields
}
ContextImpl external task ContextImpl
func NewContext ¶
func NewContext(client *camunda.Client, task *camunda.ResLockedExternalTask, workerID string) *ContextImpl
NewContext creates a new worker task ContextImpl
func (*ContextImpl) Complete ¶
func (c *ContextImpl) Complete(tc *TaskComplete) error
Complete a mark external task is complete
func (*ContextImpl) ExtendLock ¶
func (c *ContextImpl) ExtendLock(id string, duration int) error
ExtendLock extending lock on specific task ID
func (*ContextImpl) HandleBPMNError ¶
func (c *ContextImpl) HandleBPMNError(code int, message string) error
HandleBPMNError handle external task failure
func (*ContextImpl) HandleFailure ¶
func (c *ContextImpl) HandleFailure(query TaskFailureRequest) error
HandleFailure handle external task failure
func (*ContextImpl) Retries ¶
func (c *ContextImpl) Retries() int
func (*ContextImpl) StartLockExtender ¶
func (c *ContextImpl) StartLockExtender()
StartLockExtender automatically extends a lock on a remote task if the task exceeds the default locking time You should call StopExtender() to clean up resources
func (*ContextImpl) StopExtender ¶
func (c *ContextImpl) StopExtender()
StopExtender stops the task lock extender
func (*ContextImpl) TaskID ¶
func (c *ContextImpl) TaskID() string
func (*ContextImpl) TopicName ¶
func (c *ContextImpl) TopicName() string
func (*ContextImpl) Variables ¶
func (c *ContextImpl) Variables() camunda.Variables
type Options ¶
type Options struct {
// WorkerID for all request (default: `worker-{random_int}`)
WorkerID string `json:"workerId"`
// LockDuration lock duration for all external task
LockDuration time.Duration
// MaxTasks maximum tasks to receive for 1 request to camunda
MaxTasks int
// MaxParallelTaskPerHandler maximum running parallel task per handler
MaxParallelTaskPerHandler int
// UsePriority use priority
UsePriority *bool
// LongPollingTimeout long polling timeout
LongPollingTimeout time.Duration
}
Options options for Worker
type TaskComplete ¶
type TaskComplete struct {
// A JSON object containing variable key-value pairs
Variables camunda.Variables `json:"variables"`
// A JSON object containing variable key-value pairs.
// Local variables are set only in the scope of external task
LocalVariables camunda.Variables `json:"localVariables"`
}
TaskComplete a query for Complete request
type TaskFailureRequest ¶
type TaskFailureRequest struct {
// An message indicating the reason of the failure
ErrorMessage string `json:"errorMessage,omitempty"`
// A detailed error description
ErrorDetails string `json:"errorDetails,omitempty"`
// A number of how often the task should be retried.
// Must be >= 0. If this is 0, an incident is created and the task cannot be fetched anymore unless
// the retries are increased again. The incident's message is set to the errorMessage parameter
Retries int `json:"retries,omitempty"`
// A timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0
RetryTimeout int `json:"retryTimeout,omitempty"`
}
TaskFailureRequest a query for TaskFailed request
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker external task worker
func (*Worker) AddHandler ¶
func (p *Worker) AddHandler(topics []*camunda.TopicLockConfig, handler Handler)
AddHandler a add handler for external task