add request method

This commit is contained in:
Nam Huynh 2021-12-02 10:08:44 +07:00
parent 7c944a9897
commit 6664e4ef98
1 changed files with 15 additions and 0 deletions

15
request.go Normal file
View File

@ -0,0 +1,15 @@
package natsio
import (
"time"
"github.com/nats-io/nats.go"
)
// Default timeout 10s
const requestTimeout = 10 * time.Second
// Request ...
func Request(subject string, payload []byte) (*nats.Msg, error) {
return natsClient.Request(subject, payload, requestTimeout)
}