Documentation ¶
Index ¶
- type Broker
- func (broker *Broker) Bind(endpoint string) (err error)
- func (broker *Broker) ClientMsg(senderb []byte, msg [][]byte)
- func (broker *Broker) Close() (err error)
- func (broker *Broker) Purge()
- func (broker *Broker) ServiceRequire(service_frame string) (service *Service)
- func (broker *Broker) WorkerLen() int
- func (broker *Broker) WorkerMsg(senderb []byte, msg [][]byte)
- func (broker *Broker) WorkerRequire(identity string) (worker *Worker)
- type Option
- type Options
- type Service
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker The broker class defines a single broker instance:
func StartBroker ¶
StartBroker Finally here is the main task. We create a new broker instance and then processes messages on the broker socket:
func (*Broker) Bind ¶
Bind The bind method binds the broker instance to an endpoint. We can call this multiple times. Note that MDP uses a single socket for both clients and workers:
func (*Broker) ClientMsg ¶
ClientMsg Process a request coming from a client. We implement MMI requests directly here (at present, we implement only the mmi.service request):
func (*Broker) Purge ¶
func (broker *Broker) Purge()
Purge The purge method deletes any idle workers that haven't pinged us in a while. We hold workers from oldest to most recent, so we can stop scanning whenever we find a live worker. This means we'll mainly stop at the first worker, which is essential when we have large numbers of workers (since we call this method in our critical path):
func (*Broker) ServiceRequire ¶
ServiceRequire Lazy constructor that locates a service by name, or creates a new service if there is no service already with that name.
func (*Broker) WorkerMsg ¶
WorkerMsg The WorkerMsg method processes one READY, REPLY, HEARTBEAT or DISCONNECT message sent to the broker by a worker:
func (*Broker) WorkerRequire ¶
WorkerRequire Lazy constructor that locates a worker by identity, or creates a new worker if there is no worker already with that identity.
type Option ¶
type Option func(*Options)
func HeartbeatInterval ¶
func HeartbeatLiveness ¶
func WorkerAckInterval ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options broker options
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service The service class defines a single service instance:
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker The worker class defines a single worker, idle or active:
Directories ¶
Path | Synopsis |
---|---|
Majordomo Protocol Client and Worker API.
|
Majordomo Protocol Client and Worker API. |