Documentation ¶
Overview ¶
Package messaging enables the agent to perform many messaging features. Agent can register/unregister message services. Send/Reply to messages.
Index ¶
- type BasicNotifier
- type Client
- func (c *Client) RegisterService(name, msgType string, purpose ...string) error
- func (c *Client) Reply(ctx context.Context, msg json.RawMessage, msgID string, startNewThread bool, ...) (json.RawMessage, error)
- func (c *Client) Send(msg json.RawMessage, opts ...SendMessageOpions) (json.RawMessage, error)
- func (c *Client) Services() []string
- func (c *Client) UnregisterService(name string) error
- type FilterNotification
- type MessageHandler
- type NotificationPayload
- type Notifier
- type SendMessageOpions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicNotifier ¶
type BasicNotifier struct {
// contains filtered or unexported fields
}
BasicNotifier is channel based implementation of basic notifier.
func NewNotifier ¶
func NewNotifier(connection chan NotificationPayload, filter FilterNotification) *BasicNotifier
NewNotifier return notifier instance.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client enable access to messaging features.
func New ¶
func New(ctx provider, registrar MessageHandler, notifier Notifier) (*Client, error)
New return new instance of message client.
func (*Client) RegisterService ¶
RegisterService registers new message service to message handler registrar.
func (*Client) Reply ¶
func (c *Client) Reply(ctx context.Context, msg json.RawMessage, msgID string, startNewThread bool, waitForResponse string) (json.RawMessage, error)
Reply sends reply to existing message.
func (*Client) Send ¶
func (c *Client) Send(msg json.RawMessage, opts ...SendMessageOpions) (json.RawMessage, error)
Send sends new message based on destination options provided.
func (*Client) UnregisterService ¶
UnregisterService unregisters given message service handler registrar.
type FilterNotification ¶
FilterNotification filters incoming notifications.
type MessageHandler ¶
type MessageHandler interface { // Services returns list of available message services in this message handler Services() []dispatcher.MessageService // Register registers given message services to this message handler Register(msgSvcs ...dispatcher.MessageService) error // Unregister unregisters message service with given name from this message handler Unregister(name string) error }
MessageHandler maintains registered message services and it allows dynamic registration of message services.
type NotificationPayload ¶
NotificationPayload represent notification payload.
type SendMessageOpions ¶
type SendMessageOpions func(opts *sendMsgOpts)
SendMessageOpions is the options for choosing message destinations.
func SendByConnectionID ¶
func SendByConnectionID(connectionID string) SendMessageOpions
SendByConnectionID option to choose message destination by connection ID.
func SendByDestination ¶
func SendByDestination(destination *service.Destination) SendMessageOpions
SendByDestination option to set message destination.
func SendByTheirDID ¶
func SendByTheirDID(theirDID string) SendMessageOpions
SendByTheirDID option to choose message destination by connection ID.
func WaitForResponse ¶
func WaitForResponse(ctx context.Context, responseType string) SendMessageOpions
WaitForResponse option to set message response type. Message reply will wait for the response of this message type and matching thread ID.