Documentation
¶
Index ¶
- type Binding
- type Config
- type Consume
- type Duration
- type Exchange
- type Handler
- type HandlerFunc
- type Header
- type Logger
- type MT
- func (t *MT) AddHandler(serviceName ServiceName, handler HandlerFunc)
- func (t *MT) Call(serviceName ServiceName, request Request, reply ReplyFunc) (err error)
- func (t *MT) Cast(serviceName ServiceName, request Request) (err error)
- func (t *MT) ConnectAndServe() error
- func (t *MT) HealthCheck() bool
- func (t *MT) Shutdown() error
- type MassTransport
- type Option
- type Queue
- type ReplyFunc
- type ReplyQueue
- type Request
- type Response
- type Service
- type ServiceName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶ added in v1.1.0
type Binding struct {
Key string `json:"key,omitempty"`
NoWait bool `json:"nowait,omitempty"`
Arguments amqp.Table `json:"arguments,omitempty"`
}
func DefaultBinding ¶ added in v1.1.0
func DefaultBinding() Binding
type Config ¶
type Config struct {
Services map[ServiceName]Service `json:"services"`
}
Config ...
func ParseConfig ¶
ParseConfig read config from json.
type Consume ¶ added in v1.1.0
type Consume struct {
Tag string `json:"tag,omitempty"`
// управление сообщением в случае невозможности обработки
// true - сообщение вновь ставится в очередь
// false - отбросить сообщение в отстойник, если он настроен. Иначе удалить сообщение
Requeue bool `json:"requeue,omitempty"`
NoAck bool `json:"noack,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
NoWait bool `json:"nowait,omitempty"`
Arguments amqp.Table `json:"arguments,omitempty"`
}
func DefaultConsumer ¶ added in v1.1.0
func DefaultConsumer() Consume
type Duration ¶ added in v1.1.2
func (*Duration) UnmarshalJSON ¶ added in v1.1.2
type Exchange ¶ added in v1.1.0
type Exchange struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Durable bool `json:"durable,omitempty"`
AutoDelete bool `json:"autodelete,omitempty"`
Internal bool `json:"internal,omitempty"`
NoWait bool `json:"nowait,omitempty"`
Arguments amqp.Table `json:"arguments,omitempty"`
Binding Binding `json:"binding,omitempty"`
Queue Queue `json:"queue,omitempty"`
ReplyQueue ReplyQueue `json:"replyqueue,omitempty"`
}
func DefaultExchange ¶ added in v1.1.0
func DefaultExchange() Exchange
func (*Exchange) UnmarshalJSON ¶ added in v1.1.0
type HandlerFunc ¶ added in v1.1.0
type Header ¶
A Header represents the key-value pairs in a message header.
type Logger ¶
type Logger interface {
Infof(format string, args ...interface{})
Errorf(format string, args ...interface{})
Debugf(format string, args ...interface{})
}
Logger is an interface for logger to pass into mt server.
type MT ¶
type MT struct {
// contains filtered or unexported fields
}
func (*MT) AddHandler ¶ added in v1.1.0
func (t *MT) AddHandler(serviceName ServiceName, handler HandlerFunc)
func (*MT) Call ¶
func (t *MT) Call(serviceName ServiceName, request Request, reply ReplyFunc) (err error)
func (*MT) ConnectAndServe ¶
func (*MT) HealthCheck ¶
type MassTransport ¶ added in v1.1.0
type MassTransport interface {
ConnectAndServe() error
AddHandler(ServiceName, HandlerFunc)
Call(ServiceName, Request, ReplyFunc) error
Cast(ServiceName, Request) error
Shutdown() error
HealthCheck() bool
}
MassTransport is a interface.
type Queue ¶ added in v1.1.0
type Queue struct {
Name string `json:"name,omitempty"`
Durable bool `json:"durable,omitempty"`
AutoDelete bool `json:"autodelete,omitempty"`
NoWait bool `json:"nowait,omitempty"`
Arguments amqp.Table `json:"arguments,omitempty"`
// @see http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/
// Консумер не получит следующие n сообщений, пока не подтвердит предыдущие.
PrefetchCount int `json:"prefetchCount,omitempty"`
Consumer Consume `json:"consume,omitempty"`
}
func DefaultQueue ¶ added in v1.1.0
func DefaultQueue() Queue
type ReplyQueue ¶ added in v1.1.2
type ServiceName ¶ added in v1.1.0
type ServiceName string
Click to show internal directories.
Click to hide internal directories.