Categorygithub.com/bitly/go-nsq
modulepackage
0.3.7
Repository: https://github.com/bitly/go-nsq.git
Documentation: pkg.go.dev

# README

go-nsq

go-nsq is the official Go package for NSQ.

The latest stable release is 0.3.7

Build Status

It provides high-level Reader and Writer types to implement consumers and producers as well as low-level functions to communicate over the NSQ protocol.

See the main repo apps directory for examples of clients built using this package.

Installing

$ go get github.com/bitly/go-nsq

Docs

See godoc for pretty documentation or:

# in the go-nsq package directory
$ go doc

# Functions

ApiRequest is a helper function to perform an HTTP request and parse our NSQ daemon's expected response format, with deadlines.
DecodeMessage deseralizes data (as []byte) and creates a new Message.
Finish creates a new Command to indiciate that a given message (by id) has been processed successfully.
Identify creates a new Command to provide information about the client.
IsValidChannelName checks a channel name for correctness.
IsValidTopicName checks a topic name for correctness.
MultiPublish creates a new Command to write more than one message to a given topic.
NewConn returns a new Conn instance.
A custom http.Transport with support for deadline timeouts.
NewMessage creates a Message, initializes some metadata, and returns a pointer.
NewReader creates a new instance of Reader for the specified topic/channel The returned Reader instance is setup with sane default values.
NewWriter returns an instance of Writer for the specified address.
Nop creates a new Command that has no effect server side.
Ping creates a new Command to keep-alive the state of all the announced topic/channels for a given client.
Publish creates a new Command to write a message to a given topic.
ReadResponse is a client-side utility function to read from the supplied Reader according to the NSQ protocol spec: [x][x][x][x][x][x][x][x]..
Ready creates a new Command to specify the number of messages a client is willing to receive.
Register creates a new Command to add a topic/channel for the connected nsqd.
Requeue creates a new Command to indicate that a given message (by id) should be requeued after the given timeout (in ms) NOTE: a timeout of 0 indicates immediate requeue.
StartClose creates a new Command to indicate that the client would like to start a close cycle.
Subscribe creates a new Command to subscribe to the given topic/channel.
Touch creates a new Command to reset the timeout for a given message (by id).
UnpackResponse is a client-side utility function that unpacks serialized data according to NSQ protocol spec: [x][x][x][x][x][x][x][x]..
Unregister creates a new Command to remove a topic/channel for the connected nsqd.

# Constants

The amount of time nsqd will allow a client to idle, can be overriden.
when an error occurred.
when it's a serialized message.
when successful.
The number of bytes for a Message.Id.
close has started.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

returned from ConnectToNSQ when already connected.
returned from ConnectToLookupd when given lookupd address exists already.
returned when a publish command is made against a Writer that is not connected.
returned from updateRdy if over max-in-flight.
returned when a publish command is made against a Writer that has been stopped.
No description provided by the author
No description provided by the author

# Structs

Command represents a command from a client to an NSQ daemon.
Conn represents a connection to nsqd Conn exposes a set of callbacks for the various events that occur on a connection.
No description provided by the author
FinishedMessage is the data type used over responseChan in AsyncHandlers.
IdentifyResponse represents the metadata returned from an IDENTIFY command to nsqd.
Message is the fundamental data type containing the id, body, and metadata.
Reader is a high-level type to consume from NSQ.
Writer is a high-level type to publish to NSQ.
WriterTransaction is returned by the async publish methods to retrieve metadata about the command after the response is received.

# Interfaces

AsyncHandler is the asynchronous interface to Reader.
FailedMessageLogger is an interface that can be implemented by handlers that wish to receive a callback when a message is deemed "failed" (i.e.
Handler is the synchronous interface to Reader.

# Type aliases

No description provided by the author