Skip to content

Commit

Permalink
Merge pull request #139 from mreiferson/dpub_139
Browse files Browse the repository at this point in the history
DPUB
  • Loading branch information
jehiah committed May 3, 2015
2 parents 91f8996 + 4271cd1 commit f112f7a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@ func Publish(topic string, body []byte) *Command {
return &Command{[]byte("PUB"), params, body}
}

// MultiPublish creates a new Command to write more than one message to a given topic.
// This is useful for high-throughput situations to avoid roundtrips and saturate the pipe.
// DeferredPublish creates a new Command to write a message to a given topic
// where the message will queue at the channel level until the timeout expires
func DeferredPublish(topic string, delay time.Duration, body []byte) *Command {
var params = [][]byte{[]byte(topic), []byte(strconv.Itoa(int(delay / time.Millisecond)))}
return &Command{[]byte("DPUB"), params, body}
}

// MultiPublish creates a new Command to write more than one message to a given topic
// (useful for high-throughput situations to avoid roundtrips and saturate the pipe)
func MultiPublish(topic string, bodies [][]byte) (*Command, error) {
var params = [][]byte{[]byte(topic)}

Expand Down

0 comments on commit f112f7a

Please sign in to comment.