This PR sets out to resolve #360 with the integration of context.Context in the nsq.Producer. In order to maintain backwards compatibility, new methods were added that have names with the suffix WithContext. These new methods mostly correspond to those that a client would use to publish messages and they adhere to context timeouts/deadlines. Once the deadline has been reached, an error will be returned to the client and the given ProducerTransaction will be dropped/not published, all while keeping the connection to nsqd alive.
An overview of the new methods added are below:
nsq.Conn
ConnectWithContext
WriteCommandWithContext
nsq.Producer
PingWithContext
PublishWithContext
MultiPublishWithContext
DeferredPublishWithContext
PublishAsyncWithContext
MultiPublishAsyncWithContext
DeferredPublishAsyncWithContext
The idea here being that these WithContext methods would essentially replace the existing ones eventually, which would be a breaking/major version change for go-nsq.
This PR sets out to resolve #360 with the integration of context.Context in the
nsq.Producer
. In order to maintain backwards compatibility, new methods were added that have names with the suffixWithContext
. These new methods mostly correspond to those that a client would use to publish messages and they adhere to context timeouts/deadlines. Once the deadline has been reached, an error will be returned to the client and the givenProducerTransaction
will be dropped/not published, all while keeping the connection tonsqd
alive.An overview of the new methods added are below:
nsq.Conn
nsq.Producer
The idea here being that these
WithContext
methods would essentially replace the existing ones eventually, which would be a breaking/major version change forgo-nsq
.