We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c499ac7 commit b983a48Copy full SHA for b983a48
nsq.go
@@ -6,6 +6,8 @@ import (
6
"io/ioutil"
7
"net/http"
8
"net/url"
9
+ "strconv"
10
+ "time"
11
12
"github.com/pkg/errors"
13
)
@@ -28,6 +30,16 @@ func (c *Client) Publish(topic string, message []byte) (err error) {
28
30
return
29
31
}
32
33
+func (c *Client) DeferredPublish(topic string, delay time.Duration, message []byte) (err error) {
34
+ delayStr := strconv.FormatUint(uint64(delay/time.Millisecond), 10)
35
+
36
+ _, err = c.do("POST", "/pub", url.Values{
37
+ "topic": []string{topic},
38
+ "defer": []string{delayStr},
39
+ }, message)
40
+ return
41
+}
42
43
func (c *Client) MutliPublish(topic string, messages ...[]byte) (err error) {
44
_, err = c.do("POST", "/mpub", url.Values{
45
"topic": []string{topic},
0 commit comments