queues

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchMessage

type BatchMessage struct {
	// contains filtered or unexported fields
}

func NewBytesBatchMessage

func NewBytesBatchMessage(content []byte, opts ...SendOption) *BatchMessage

NewBytesBatchMessage creates a single byte array message to be batched before sending to a queue.

func NewJSONBatchMessage

func NewJSONBatchMessage(content any, opts ...SendOption) *BatchMessage

NewJSONBatchMessage creates a single JSON message to be batched before sending to a queue.

func NewTextBatchMessage

func NewTextBatchMessage(content string, opts ...SendOption) *BatchMessage

NewTextBatchMessage creates a single text message to be batched before sending to a queue.

func NewV8BatchMessage

func NewV8BatchMessage(content js.Value, opts ...SendOption) *BatchMessage

NewV8BatchMessage creates a single raw JS value message to be batched before sending to a queue.

type BatchSendOption

type BatchSendOption func(*batchSendOptions)

func WithBatchDelaySeconds

func WithBatchDelaySeconds(d time.Duration) BatchSendOption

WithBatchDelaySeconds changes the number of seconds to delay the message.

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(queueName string) (*Producer, error)

NewProducer creates a new Producer object to send messages to a queue. queueName is the name of the queue environment var to send messages to. In Cloudflare API documentation, this object represents the Queue.

func (*Producer) SendBatch

func (p *Producer) SendBatch(messages []*BatchMessage, opts ...BatchSendOption) error

SendBatch sends multiple messages to a queue. This function allows setting options for each message.

func (*Producer) SendBytes

func (p *Producer) SendBytes(body []byte, opts ...SendOption) error

SendBytes sends a single byte array message to a queue.

func (*Producer) SendJSON

func (p *Producer) SendJSON(body any, opts ...SendOption) error

SendJSON sends a single JSON message to a queue.

func (*Producer) SendText

func (p *Producer) SendText(body string, opts ...SendOption) error

SendText sends a single text message to a queue.

func (*Producer) SendV8

func (p *Producer) SendV8(body js.Value, opts ...SendOption) error

SendV8 sends a single raw JS value message to a queue.

type SendOption

type SendOption func(*sendOptions)

func WithDelaySeconds

func WithDelaySeconds(d time.Duration) SendOption

WithDelaySeconds changes the number of seconds to delay the message.

Jump to

Keyboard shortcuts

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