Documentation
¶
Overview ¶
Package lastbackend/prc implements an amqp queue based messaging system. Like the standard AMQP application rpc.Router matches incoming messages against a list of registered routes and upstream and calls a handler for the route or upstream that matches the route name or upstream or other conditions. The main features are:
- Messages routing can be matched based received router, upstream.
- You can send many types of messages, with or without confirmation.
Each app automatically join in a group by its name, you can set uuid of registered app to provide better delivery.
You should start with your app registering:
func main() { r := rpc.Register() r.SetHandler("handler", SomeHandler) }
Setup handler and upstream examples:
r := rpc.Register() r.SetHandler("handler", SomeHandler) r.SetUpstream("upstream", SomeUpstream)
Handlers and Upstreams examples:
// SomeHandler definition func SomeHandler(s rpc.Sender, message []byte) error { } // SomeUpstream definition func SomeUpstream(s rpc.Sender, r rpc.Recipient, message []byte) error { }
Index ¶
- Variables
- type Destination
- type Handler
- type RPC
- func (r *RPC) Call(d Destination, message interface{}) error
- func (r *RPC) CallBinary(d Destination, message []byte) error
- func (r *RPC) CallSigned(s Sender, d Destination, message interface{}) error
- func (r *RPC) CallSignedBinary(s Sender, d Destination, message []byte) error
- func (r *RPC) Cast(d Destination, message interface{}) error
- func (r *RPC) CastBinary(d Destination, message []byte) error
- func (r *RPC) CastSigned(s Sender, d Destination, message interface{}) error
- func (r *RPC) CastSignedBinary(s Sender, d Destination, message []byte) error
- func (r *RPC) Cleanup()
- func (r *RPC) Connected() chan bool
- func (r *RPC) Listen()
- func (r *RPC) ProxyCall(d Destination, p Receiver, message interface{}) error
- func (r *RPC) ProxyCallBinary(d Destination, p Receiver, message []byte) error
- func (r *RPC) ProxyCast(d Destination, p Receiver, message interface{}) error
- func (r *RPC) ProxyCastBinary(d Destination, p Receiver, message []byte) error
- func (r *RPC) SetHandler(h string, f Handler)
- func (r *RPC) SetLimit(limit int)
- func (r *RPC) SetURI(uri string)
- func (r *RPC) SetUpstream(u string, f Upstream)
- func (r *RPC) Shutdown()
- type Receiver
- type Sender
- type Upstream
Constants ¶
This section is empty.
Variables ¶
var ( ERRINVALIDLENGTH = errors.New("Invalid length of message field") ERRINVALIDTOKEN = errors.New("Invalid authentication token") )
Functions ¶
This section is empty.
Types ¶
type Destination ¶
func (*Destination) Sign ¶
func (d *Destination) Sign() ([]byte, error)
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
func (*RPC) Call ¶
func (r *RPC) Call(d Destination, message interface{}) error
Call - send message with delivery guarantee
func (*RPC) CallBinary ¶
func (r *RPC) CallBinary(d Destination, message []byte) error
CallBinary - send binary message with delivery guarantee
func (*RPC) CallSigned ¶
func (r *RPC) CallSigned(s Sender, d Destination, message interface{}) error
CallSigned - send signed message with delivery guarantee
func (*RPC) CallSignedBinary ¶
func (r *RPC) CallSignedBinary(s Sender, d Destination, message []byte) error
CallSignedBinary - send signed binary message with delivery guarantee
func (*RPC) Cast ¶
func (r *RPC) Cast(d Destination, message interface{}) error
Cast - send message without delivery guarantee
func (*RPC) CastBinary ¶
func (r *RPC) CastBinary(d Destination, message []byte) error
CastBinary - send binary message without delivery guarantee
func (*RPC) CastSigned ¶
func (r *RPC) CastSigned(s Sender, d Destination, message interface{}) error
CastSigned - send signed message without delivery guarantee
func (*RPC) CastSignedBinary ¶
func (r *RPC) CastSignedBinary(s Sender, d Destination, message []byte) error
CastSignedBinary - send signed binary message without delivery guarantee
func (*RPC) ProxyCall ¶
func (r *RPC) ProxyCall(d Destination, p Receiver, message interface{}) error
Proxy send message methods ProxyCall - send message throw another application with delivery guarantee
func (*RPC) ProxyCallBinary ¶
func (r *RPC) ProxyCallBinary(d Destination, p Receiver, message []byte) error
ProxyCallBinary - send binary message throw another application with delivery guarantee
func (*RPC) ProxyCast ¶
func (r *RPC) ProxyCast(d Destination, p Receiver, message interface{}) error
ProxyCast - send message throw another application without delivery guarantee
func (*RPC) ProxyCastBinary ¶
func (r *RPC) ProxyCastBinary(d Destination, p Receiver, message []byte) error
ProxyCastBinary - send message throw another application without delivery guarantee
func (*RPC) SetHandler ¶
SetHeader - set handler routing
func (*RPC) SetUpstream ¶
SetUpstream - set upstream routing