lmq

package module
v0.0.0-...-67b4309 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 14 Imported by: 0

README

go-lmq

A golang client library for LMQ.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EOF       = errors.New("lmq: message reached EOF")
	ErrDecode = errors.New("lmq: message decode error")

	DefaultDecoder = new(duplicator)
)
View Source
var DefaultTimeout = 10 * time.Second

Functions

func RegisterDecoder

func RegisterDecoder(contentType string, d Decoder)

Types

type Client

type Client interface {
	Push(string, string, io.Reader) (*PushResponse, error)
	PushAll(string, string, io.Reader) (map[string]*PushResponse, error)
	Pull(string, time.Duration) (*Message, error)
	PullAny(string, time.Duration) (*Message, error)
	Reply(*Message, ReplyType) error
	Delete(string) error
	GetProperty(string) (*Property, error)
	UpdateProperty(string, *Property) error
	DeleteProperty(string) error
	GetDefaultProperty() ([]*DefaultProperty, error)
	SetDefaultProperty([]*DefaultProperty) error
	DeleteDefaultProperty() error
}

func New

func New(url string) Client

type Decoder

type Decoder interface {
	Decode([]byte, interface{}) error
}

type DecoderFunc

type DecoderFunc func([]byte, interface{}) error

func (DecoderFunc) Decode

func (f DecoderFunc) Decode(b []byte, v interface{}) error

type DefaultProperty

type DefaultProperty struct {
	Pattern  string
	Property *Property
}

func (*DefaultProperty) MarshalJSON

func (p *DefaultProperty) MarshalJSON() ([]byte, error)

func (*DefaultProperty) UnmarshalJSON

func (p *DefaultProperty) UnmarshalJSON(b []byte) error

type Error

type Error struct {
	Code    int
	Message string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) IsEmpty

func (e *Error) IsEmpty() bool

type Message

type Message struct {
	ID          string
	Queue       string
	MessageType string
	Retry       int
	ContentType string
	Body        []byte
	// contains filtered or unexported fields
}

func (*Message) Decode

func (m *Message) Decode(v interface{}) error

type Property

type Property struct {
	Accum   time.Duration
	Retry   int
	Timeout time.Duration
}

func NewProperty

func NewProperty() *Property

func (*Property) MarshalJSON

func (p *Property) MarshalJSON() ([]byte, error)

func (*Property) UnmarshalJSON

func (p *Property) UnmarshalJSON(b []byte) error

type PushResponse

type PushResponse struct {
	Accum string `json:"accum"`
}

type ReplyType

type ReplyType int
const (
	ReplyAck ReplyType = iota
	ReplyNack
	ReplyExt
)

func (ReplyType) String

func (r ReplyType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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