queue

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

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(queue string, task NitricTask) error
	// SendBatch - sends multiple tasks to a queue
	SendBatch(queue string, tasks []NitricTask) (*SendBatchResponse, error)
	// Receive - Receives one or more tasks(s) off a queue
	Receive(options ReceiveOptions) ([]NitricTask, error)
	// Complete - Marks a received task as completed
	Complete(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(queue string, leaseId string) error

func (*UnimplementedQueuePlugin) Receive

func (*UnimplementedQueuePlugin) Send

func (*UnimplementedQueuePlugin) Send(queue string, task NitricTask) error

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

func (*UnimplementedQueuePlugin) SendBatch

func (*UnimplementedQueuePlugin) SendBatch(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