Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateKey(topic string, params map[string]string) string
- type Config
- type Connector
- type Manager
- type Metadata
- type Queue
- type Request
- type ResponseHandler
- type ResponseHandlerSetter
- type ResponsiveConnector
- type Runner
- type Sender
- type SenderSetter
- type Subscriber
- type SubscriberData
Constants ¶
View Source
const ( DefaultWorkers = 1 SubstitutePath = "/substitute/" )
Variables ¶
View Source
var ( TopicParam = "topic" ConnectorParam = "connector" )
Functions ¶
Types ¶
type Connector ¶
type Manager ¶
type Manager interface {
Load() error
List() []Subscriber
Filter(map[string]string) []Subscriber
Find(string) Subscriber
Exists(string) bool
Create(protocol.Path, router.RouteParams) (Subscriber, error)
Add(Subscriber) error
Update(Subscriber) error
Remove(Subscriber) error
}
type Queue ¶
type Queue interface {
ResponseHandlerSetter
SenderSetter
Start() error
Push(request Request) error
Stop() error
}
Queue is an interface modeling a task-queue (it is started and more Requests can be pushed to it, and finally it is stopped after all requests are handled).
type Request ¶
type Request interface {
Subscriber() Subscriber
Message() *protocol.Message
}
func NewRequest ¶
func NewRequest(s Subscriber, m *protocol.Message) Request
type ResponseHandler ¶
type ResponseHandlerSetter ¶
type ResponseHandlerSetter interface {
ResponseHandler() ResponseHandler
SetResponseHandler(ResponseHandler)
}
type ResponsiveConnector ¶
type ResponsiveConnector interface {
Connector
ResponseHandler
}
type Runner ¶
type Runner interface {
Run(Subscriber)
}
type SenderSetter ¶
type Subscriber ¶
type Subscriber interface {
// Reset will recreate the route inside the subscribe with the information stored
// in the subscriber data
Reset() error
Key() string
Route() *router.Route
Filter(map[string]string) bool
Loop(context.Context, Queue) error
SetLastID(ID uint64)
Cancel()
Encode() ([]byte, error)
}
func NewSubscriber ¶
func NewSubscriber(topic protocol.Path, params router.RouteParams, lastID uint64) Subscriber
func NewSubscriberFromData ¶
func NewSubscriberFromData(data SubscriberData) Subscriber
func NewSubscriberFromJSON ¶
func NewSubscriberFromJSON(data []byte) (Subscriber, error)
type SubscriberData ¶
type SubscriberData struct {
Topic protocol.Path
Params router.RouteParams
LastID uint64
}
Click to show internal directories.
Click to hide internal directories.