Versions in this module Expand all Collapse all v0 v0.5.0 Jun 19, 2024 Changes in this version + const HeaderControl + const HeaderControlAck + const HeaderControlDone + const HeaderControlProceed + const HeaderSequence + const HeaderUID + var ErrClient = errors.New("stream client error") + var ErrProtocolViolation = fmt.Errorf("%w: %s", ErrClient, "protocol violation") + func Middleware(next peanats.Handler) peanats.Handler + type Client interface + Start func(ctx context.Context, subj string, data []byte) (Receiver, error) + func NewClient(conn peanats.Connection, opts ...ClientOption) Client + type ClientOption = func(*clientImpl) *clientImpl + func WithReplySubjecter(rs ReplySubjecter) ClientOption + type Receiver interface + Receive func(context.Context) (*nats.Msg, error) + ReceiveAll func(context.Context) ([]*nats.Msg, error) + Sequence func() int + UID func() string + type ReplySubjecter interface + ReplySubject func() string + func ReplySubjectCryptoRand() ReplySubjecter + func ReplySubjectNUID() ReplySubjecter + func ReplySubjectRand() ReplySubjecter + type ReplySubjecterFunc func() string + func (f ReplySubjecterFunc) ReplySubject() string + type TypedClient interface + Start func(ctx context.Context, subj string, arg *A) (TypedReceiver[R], error) + func NewTypedClient[A, R any](nc peanats.Connection, opts ...TypedClientOption[A, R]) TypedClient[A, R] + type TypedClientOption func(*typedClientImpl[A, R]) *typedClientImpl[A, R] + func WithCodec[A, R any](codec peanats.Codec) TypedClientOption[A, R] + func WithTypedReplySubjecter[A, R any](rs ReplySubjecter) TypedClientOption[A, R] + type TypedReceiver interface + Receive func(context.Context) (*T, error) + ReceiveAll func(context.Context) ([]*T, error) + Sequence func() int + UID func() string