chronomq

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientDisconnected = errors.New("Client is not connected to the server")

ErrClientDisconnected means a client was used while it was disconnected from the remote server

Functions

This section is empty.

Types

type Client

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

Client communicates with the Chronomq RPC server

func NewClient

func NewClient(addr string) (*Client, error)

NewClient creates an rpc client and tries to connect to a Chronomq RCP Server. Returns a connected client Once connected, a client may be used by multiple goroutines simultaneously.

func (*Client) Cancel

func (c *Client) Cancel(id string) error

Cancel deletes a job identified by the given id. Calls to cancel are idempotent

func (*Client) Close

func (c *Client) Close() error

Close the client connection

func (*Client) InspectN

func (c *Client) InspectN(n int, jobs *[]*Job) error

InspectN fetches upto n number of jobs from the server without consuming them

func (*Client) Next

func (c *Client) Next(timeout time.Duration) (string, []byte, error)

Next wait at-most timeout duration to return a ready job body from Chronomq If no job is available within the timeout, ErrTimeout is returned and clients should try again later

func (*Client) Ping

func (c *Client) Ping() error

Ping the server and check connectivity

func (*Client) Put

func (c *Client) Put(body []byte, delay time.Duration) (string, error)

Put saves a job with Chronomq and returns the auto-generated job id

func (*Client) PutWithID

func (c *Client) PutWithID(id string, body []byte, delay time.Duration) error

PutWithID saves a job with Chronomq against a given id.

type Job

type Job struct {
	Body  []byte
	ID    string
	Delay time.Duration
}

Job is a light wrapper struct representing job data on the wire without extra metadata that is stored internally

Jump to

Keyboard shortcuts

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