Documentation ¶
Index ¶
- Variables
- type Call
- type Client
- func (c *Client) Ack(ctx context.Context, queue string, task server.TaskID) (err error)
- func (c *Client) Close()
- func (c *Client) DeQ(ctx context.Context, queue string) (task server.Task, err error)
- func (c *Client) EnQ(ctx context.Context, queue string, body []byte) (id server.TaskID, err error)
- func (c *Client) GoAck(queue string, taskID server.TaskID, call Call) (server.ReqID, Call)
- func (c *Client) GoDeQ(queue string, call Call) (server.ReqID, Call)
- func (c *Client) GoEnQ(queue string, body []byte, call Call) (server.ReqID, Call)
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidResType returned when the response type sent by the server is // invalid. ErrInvalidResType = errors.New("taskq client: invalid response type") // ErrRequestNotFound returned when the request id is not found. ErrRequestNotFound = errors.New("taskq client: request not found") // ErrInvalidResponse returned when the server response is invalid. ErrInvalidResponse = errors.New("taskq client: invalid response") )
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call chan Response
Call represents one asynchronous request enqued by the client. Once the response is received, the client will send it over this channel.
type Client ¶
Client represents a client to a taskq server.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the client and its underlying connection. All pending calls will be returned with an error.
func (*Client) EnQ ¶
EnQ enqueues a task with the given body in the queue. It returns the task's id or an error.
func (*Client) GoAck ¶
GoAck acknowledges a task in the given queue. This method returns the request ID and the Call represeting the enque.
If call is nil in the arguments, this method returns a new call. Otherwise it reuses and returns the provided call.
func (*Client) GoDeQ ¶
GoDeQ dequeues a task from the given queue. This method returns the request ID and the Call represeting the enque.
If call is nil in the arguments, this method returns a new call. Otherwise it reuses and returns the provided call.