Documentation
¶
Index ¶
- type BatchMessage
- type BatchSendOption
- type Producer
- func (p *Producer) SendBatch(messages []*BatchMessage, opts ...BatchSendOption) error
- func (p *Producer) SendBytes(body []byte, opts ...SendOption) error
- func (p *Producer) SendJSON(body any, opts ...SendOption) error
- func (p *Producer) SendText(body string, opts ...SendOption) error
- func (p *Producer) SendV8(body js.Value, opts ...SendOption) error
- type SendOption
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 ¶
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.
type SendOption ¶
type SendOption func(*sendOptions)
func WithDelaySeconds ¶
func WithDelaySeconds(d time.Duration) SendOption
WithDelaySeconds changes the number of seconds to delay the message.