Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(codec encoding.Codec, msg Any) ([]byte, error)
- func Unmarshal(codec encoding.Codec, inputData []byte, outValue interface{}) error
- type Any
- type Binder
- type Broker
- type EncodeErrorFunc
- type Event
- type Handler
- type Headers
- type Message
- type Option
- func OptionContextWithValue(k, v interface{}) Option
- func WithAddress(addressList ...string) Option
- func WithClientId(clientId string) Option
- func WithCodec(name string) Option
- func WithDisconnect(f func()) Option
- func WithEnableSecure(enable bool) Option
- func WithErrorHandler(handler Handler) Option
- func WithGlobalPropagator() Option
- func WithGlobalTracerProvider() Option
- func WithLogger(logger log.Logger) Option
- func WithOnConnect(f func()) Option
- func WithOptionContext(ctx context.Context) Option
- func WithPropagator(propagators propagation.TextMapPropagator) Option
- func WithTLSConfig(config *tls.Config) Option
- func WithTracerProvider(provider trace.TracerProvider, tracerName string) Option
- type Options
- type PublishOption
- type PublishOptions
- type RespEvent
- type SubscribeOption
- type SubscribeOptions
- type Subscriber
Constants ¶
View Source
const ( MessageAct = "Message-Act" MessageId = "Message-Id" MessageFrom = "Massage-From" MeggageTo = "Massage-To" Identifier = "Identifier" Failed = "Failed" MaggageToken = "Massage-Token" ContextCodec = "Context-Codec" TimeStampFrom = "TimeStampFrom" TimeStampTo = "TimeStampTo" Host = "Host" Connection = "Connection" ContentType = "Content-Type" TransferEncoding = "Transfer-Encoding" AcceptEncoding = "Accept-Encoding" Authorization = "Authorization" ContentLength = "Content-Length" SessionId = "SessionId" )
/////////////////////////////////////////////////////////////////////////////
Variables ¶
View Source
var (
DefaultCodec encoding.Codec = nil
)
Functions ¶
Types ¶
type Broker ¶
type Broker interface { Name() string Options() Options Address() string Init(...Option) error Connect() error ConnectRetry() error Disconnect() error Publish(topic string, msg Any, opts ...PublishOption) error PublishRaw(topic string, msg []byte, opts ...PublishOption) error Subscribe(topic string, handler Handler, binder Binder, opts ...SubscribeOption) (Subscriber, error) }
type EncodeErrorFunc ¶
EncodeErrorFunc is encode error func.
type Message ¶
func (Message) GetHeaders ¶
type Option ¶
type Option func(*Options)
func OptionContextWithValue ¶
func OptionContextWithValue(k, v interface{}) Option
func WithDisconnect ¶
func WithDisconnect(f func()) Option
func WithEnableSecure ¶
func WithErrorHandler ¶
func WithGlobalPropagator ¶
func WithGlobalPropagator() Option
func WithGlobalTracerProvider ¶
func WithGlobalTracerProvider() Option
func WithLogger ¶
func WithOnConnect ¶
func WithOnConnect(f func()) Option
func WithOptionContext ¶
func WithPropagator ¶
func WithPropagator(propagators propagation.TextMapPropagator) Option
func WithTLSConfig ¶
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider, tracerName string) Option
type Options ¶
type Options struct { Addrs []string ClientId string // 检查是不是发给自己的 FromTo bool Codec encoding.Codec ErrorHandler Handler Secure bool TLSConfig *tls.Config Context context.Context Tracings []tracing.Option OnConnect func() Disconncet func() Log *log.Helper // contains filtered or unexported fields }
func NewOptions ¶
func NewOptions() Options
func NewOptionsAndApply ¶
type PublishOption ¶
type PublishOption func(*PublishOptions)
func PublishContextWithValue ¶
func PublishContextWithValue(k, v interface{}) PublishOption
func WithPublishContext ¶
func WithPublishContext(ctx context.Context) PublishOption
type PublishOptions ¶
func NewPublishOptions ¶
func NewPublishOptions(opts ...PublishOption) PublishOptions
func (*PublishOptions) Apply ¶
func (o *PublishOptions) Apply(opts ...PublishOption)
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func DisableAutoAck ¶
func DisableAutoAck() SubscribeOption
func SubscribeContextWithValue ¶
func SubscribeContextWithValue(k, v interface{}) SubscribeOption
func WithQueueName ¶
func WithQueueName(name string) SubscribeOption
func WithSubscribAct ¶
func WithSubscribAct(Act int) SubscribeOption
func WithSubscribeContext ¶
func WithSubscribeContext(ctx context.Context) SubscribeOption
type SubscribeOptions ¶
type SubscribeOptions struct { AutoAck bool Act int // 0 : ,1 : req, 2 : resp, 3 : upload Queue string Context context.Context }
func NewSubscribeOptions ¶
func NewSubscribeOptions(opts ...SubscribeOption) SubscribeOptions
func (*SubscribeOptions) Apply ¶
func (o *SubscribeOptions) Apply(opts ...SubscribeOption)
type Subscriber ¶
type Subscriber interface { Options() SubscribeOptions Topic() string Unsubscribe() error }
Click to show internal directories.
Click to hide internal directories.