Documentation
¶
Overview ¶
Package bus decouples channels from the agent loop with bounded queues.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func External ¶ added in v0.11.0
External reports whether a channel is a conversation that outlives this process, and so is somewhere Factor can reach the user on its own initiative. The CLI is one process's stdin, system is Factor talking to itself, and cron is a schedule rather than an inbox: none of them is an address a heartbeat, a job result or a restart notice can be sent to.
Types ¶
type InboundMessage ¶
type InboundMessage struct {
Channel string
SenderID string
ChatID string
Content string
Time time.Time
}
func (InboundMessage) SessionKey ¶
func (m InboundMessage) SessionKey() string
SessionKey identifies the conversation a message belongs to.
type MessageBus ¶
type MessageBus struct {
// contains filtered or unexported fields
}
func New ¶
func New() *MessageBus
func (*MessageBus) Inbound ¶
func (b *MessageBus) Inbound() <-chan InboundMessage
func (*MessageBus) Outbound ¶
func (b *MessageBus) Outbound() <-chan OutboundMessage
func (*MessageBus) PendingOutbound ¶ added in v0.7.0
func (b *MessageBus) PendingOutbound() int
PendingOutbound counts replies waiting for a connector to deliver them. The gateway waits for zero before restarting: a queued message dies with the process that holds it.
func (*MessageBus) PublishInbound ¶
func (b *MessageBus) PublishInbound(msg InboundMessage) bool
PublishInbound enqueues without blocking; a full queue drops the message loudly rather than wedging a connector.
func (*MessageBus) PublishOutbound ¶
func (b *MessageBus) PublishOutbound(msg OutboundMessage) bool