Beispiel #1
0
package storage

import (
	"time"

	"github.com/yosisa/pluq/types"
	"github.com/yosisa/pluq/uid"
)

var (
	DefaultRetry   = types.Retry(10)
	DefaultTimeout = types.Duration(30 * time.Second)
)

type Envelope struct {
	ID       uid.ID
	Queue    string
	Retry    types.Retry
	Timeout  types.Duration
	Messages []*Message
}

func NewEnvelope() *Envelope {
	return &Envelope{
		Retry:   DefaultRetry,
		Timeout: DefaultTimeout,
	}
}

func (e *Envelope) AddMessage(m *Message) {
	e.Messages = append(e.Messages, m)
Beispiel #2
0
func (b scheduleData) retry() types.Retry {
	return types.Retry(binary.BigEndian.Uint32(b[8:]))
}