queue

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FailedTask

type FailedTask struct {
	Task    *NitricTask
	Message string
}

FailedTask - A task that has failed to be queued

type NitricTask

type NitricTask struct {
	ID          string                 `json:"id,omitempty" log:"ID"`
	LeaseID     string                 `json:"leaseId,omitempty" log:"LeaseID"`
	PayloadType string                 `json:"payloadType,omitempty" log:"PayLoadType"`
	Payload     map[string]interface{} `json:"payload,omitempty"`
}

NitricTask - A task for asynchronous processing

type QueueService

type QueueService interface {
	// Send - Send a single task to a queue
	Send(ctx context.Context, queue string, task NitricTask) error
	// SendBatch - sends multiple tasks to a queue
	SendBatch(ctx context.Context, queue string, tasks []NitricTask) (*SendBatchResponse, error)
	// Receive - Receives one or more tasks(s) off a queue
	Receive(ctx context.Context, options ReceiveOptions) ([]NitricTask, error)
	// Complete - Marks a received task as completed
	Complete(ctx context.Context, queue string, leaseId string) error
}

QueueService - The Nitric plugin interface for cloud native queue adapters

type ReceiveOptions

type ReceiveOptions struct {
	// Nitric name for the queue.
	//
	// queueName is a required field
	QueueName string `type:"string" required:"true" log:"QueueName"`

	// Max depth of queue messages to receive from the queue.
	//
	// If nil or 0, defaults to depth 1.
	Depth *uint32 `type:"int" required:"false" log:"Depth"`
}

func (*ReceiveOptions) Validate

func (p *ReceiveOptions) Validate() error

type SendBatchResponse

type SendBatchResponse struct {
	FailedTasks []*FailedTask
}

type UnimplementedQueuePlugin

type UnimplementedQueuePlugin struct {
	QueueService
}

UnimplementedQueuePlugin - A Default interface, that provide implementations of QueueService methods that Flag the method as unimplemented

func (*UnimplementedQueuePlugin) Complete

func (*UnimplementedQueuePlugin) Complete(ctx context.Context, queue string, leaseId string) error

func (*UnimplementedQueuePlugin) Receive

func (*UnimplementedQueuePlugin) Send

TODO: replace NitricTask and []NitricTask with pointers Push - Unimplemented Stub for the UnimplementedQueuePlugin

func (*UnimplementedQueuePlugin) SendBatch

func (*UnimplementedQueuePlugin) SendBatch(ctx context.Context, queue string, tasks []NitricTask) (*SendBatchResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL