{"modulePath":"github.com/nitrictech/nitric","version":"v0.21.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package queue\n\n## Types\n\n```go\ntype FailedTask struct {\n\tTask    *NitricTask\n\tMessage string\n}\n```\nFailedTask - A task that has failed to be queued\n\n```go\ntype NitricTask struct {\n\tID          string                 `json:\"id,omitempty\" log:\"ID\"`\n\tLeaseID     string                 `json:\"leaseId,omitempty\" log:\"LeaseID\"`\n\tPayloadType string                 `json:\"payloadType,omitempty\" log:\"PayLoadType\"`\n\tPayload     map[string]interface{} `json:\"payload,omitempty\"`\n}\n```\nNitricTask - A task for asynchronous processing\n\n```go\ntype QueueService interface {\n\t// Send - Send a single task to a queue\n\tSend(ctx context.Context, queue string, task NitricTask) error\n\t// SendBatch - sends multiple tasks to a queue\n\tSendBatch(ctx context.Context, queue string, tasks []NitricTask) (*SendBatchResponse, error)\n\t// Receive - Receives one or more tasks(s) off a queue\n\tReceive(ctx context.Context, options ReceiveOptions) ([]NitricTask, error)\n\t// Complete - Marks a received task as completed\n\tComplete(ctx context.Context, queue string, leaseId string) error\n}\n```\nQueueService - The Nitric plugin interface for cloud native queue adapters\n\n```go\ntype ReceiveOptions struct {\n\t// Nitric name for the queue.\n\t//\n\t// queueName is a required field\n\tQueueName string `type:\"string\" required:\"true\" log:\"QueueName\"`\n\n\t// Max depth of queue messages to receive from the queue.\n\t//\n\t// If nil or 0, defaults to depth 1.\n\tDepth *uint32 `type:\"int\" required:\"false\" log:\"Depth\"`\n}\n```\n\n```go\nfunc (p *ReceiveOptions) Validate() error\n```\n\n```go\ntype SendBatchResponse struct {\n\tFailedTasks []*FailedTask\n}\n```\n\n```go\ntype UnimplementedQueuePlugin struct {\n\tQueueService\n}\n```\nUnimplementedQueuePlugin - A Default interface, that provide implementations of QueueService methods that Flag the method as unimplemented\n\n```go\nfunc (*UnimplementedQueuePlugin) Complete(ctx context.Context, queue string, leaseId string) error\n```\n\n```go\nfunc (*UnimplementedQueuePlugin) Receive(ctx context.Context, options ReceiveOptions) ([]NitricTask, error)\n```\n\n```go\nfunc (*UnimplementedQueuePlugin) Send(ctx context.Context, queue string, task NitricTask) error\n```\nTODO: replace NitricTask and \\[]NitricTask with pointers Push - Unimplemented Stub for the UnimplementedQueuePlugin\n\n```go\nfunc (*UnimplementedQueuePlugin) SendBatch(ctx context.Context, queue string, tasks []NitricTask) (*SendBatchResponse, error)\n```\n\n","path":"github.com/nitrictech/nitric/pkg/plugins/queue","name":"queue","synopsis":"","isRedistributable":true}
