Documentation
¶
Index ¶
- func DefaultSentinel(msg *nats.Msg) bool
- func RequestMany(ctx context.Context, nc *nats.Conn, subject string, data []byte, ...) (iter.Seq2[*nats.Msg, error], error)
- func RequestManyMsg(ctx context.Context, nc *nats.Conn, msg *nats.Msg, opts ...RequestManyOpt) (iter.Seq2[*nats.Msg, error], error)
- type RequestManyOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSentinel ¶
DefaultSentinel is a sentinel function that stops receiving messages once a message with an empty payload is received.
func RequestMany ¶
func RequestMany(ctx context.Context, nc *nats.Conn, subject string, data []byte, opts ...RequestManyOpt) (iter.Seq2[*nats.Msg, error], error)
RequestMany will send a request payload and return an iterator to receive multiple responses. If context timeout is not set, the number of messages received is constrained by the client's timeout.
Use the RequestManyOpt functions to further configure this method's behavior. - RequestManyStall sets the stall timer, which can be used in scatter-gather scenarios where subsequent responses are expected to arrive within a certain time frame. - RequestManyMaxMessages sets the maximum number of messages to receive. - RequestManySentinel stops returning responses once a message for which the provided function returns true.
func RequestManyMsg ¶
func RequestManyMsg(ctx context.Context, nc *nats.Conn, msg *nats.Msg, opts ...RequestManyOpt) (iter.Seq2[*nats.Msg, error], error)
RequestManyMsg will send a Msg request and return an iterator to receive multiple responses. If context timeout is not set, the number of messages received is constrained by the client's timeout.
Use the RequestManyOpt functions to further configure this method's behavior. - RequestManyStall sets the stall timer, which can be used in scatter-gather scenarios where subsequent responses are expected to arrive within a certain time frame. - RequestManyMaxMessages sets the maximum number of messages to receive. - RequestManySentinel stops returning responses once a message for which the provided function returns true.
Types ¶
type RequestManyOpt ¶
type RequestManyOpt func(*requestManyOpts) error
RequestManyOpt is a function that can be used to configure the behavior of the RequestMany function.
func RequestManyMaxMessages ¶
func RequestManyMaxMessages(count int) RequestManyOpt
RequestManyMaxMessages sets the maximum number of messages to receive.
func RequestManySentinel ¶
func RequestManySentinel(f func(*nats.Msg) bool) RequestManyOpt
RequestManySentinel is a function that can be used to stop receiving messages once a sentinel message is received. A sentinel message is a message for which the provided function returns true.
func RequestManyStall ¶
func RequestManyStall(stall time.Duration) RequestManyOpt
RequestManyStall sets the stall timer, which can be used in scatter-gather scenarios where subsequent responses are expected to arrive within a certain time frame.