Documentation
¶
Overview ¶
Package "ws" provides primitives to interact with the AsyncAPI specification.
Code generated by github.com/znas-io/asyncapi-codegen version (devel) DO NOT EDIT.
Index ¶
- Constants
- type ActionSchema
- type AppController
- func (c *AppController) Close(ctx context.Context)
- func (c *AppController) PublishDisconnect(ctx context.Context, msg OkMessage) error
- func (c *AppController) SubscribeAll(ctx context.Context, as AppSubscriber) error
- func (c *AppController) SubscribeDisconnect(ctx context.Context, fn func(ctx context.Context, msg OkMessage)) error
- func (c *AppController) SubscribeFoo(ctx context.Context, fn func(ctx context.Context, msg FooMessage)) error
- func (c *AppController) UnsubscribeAll(ctx context.Context)
- func (c *AppController) UnsubscribeDisconnect(ctx context.Context)
- func (c *AppController) UnsubscribeFoo(ctx context.Context)
- type AppSubscriber
- type ControllerOption
- type Error
- type FooMessage
- type MessageWithCorrelationID
- type OkMessage
- type PersonSchema
- type RegistrationSchema
- type UserController
- func (c *UserController) Close(ctx context.Context)
- func (c *UserController) PublishDisconnect(ctx context.Context, msg OkMessage) error
- func (c *UserController) PublishFoo(ctx context.Context, msg FooMessage) error
- func (c *UserController) SubscribeAll(ctx context.Context, as UserSubscriber) error
- func (c *UserController) SubscribeDisconnect(ctx context.Context, fn func(ctx context.Context, msg OkMessage)) error
- func (c *UserController) UnsubscribeAll(ctx context.Context)
- func (c *UserController) UnsubscribeDisconnect(ctx context.Context)
- type UserSchema
- type UserSubscriber
Constants ¶
const AsyncAPIVersion = "0.0.1"
AsyncAPIVersion is the version of the used AsyncAPI document
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionSchema ¶
type ActionSchema struct {
Action *string `json2:"action-Boy"`
}
ActionSchema is a schema from the AsyncAPI specification required in messages
type AppController ¶
type AppController struct {
// contains filtered or unexported fields
}
AppController is the structure that provides publishing capabilities to the developer and and connect the broker with the App
func NewAppController ¶
func NewAppController(bc extensions.BrokerController, options ...ControllerOption) (*AppController, error)
NewAppController links the App to the broker
func (*AppController) Close ¶
func (c *AppController) Close(ctx context.Context)
Close will clean up any existing resources on the controller
func (*AppController) PublishDisconnect ¶
func (c *AppController) PublishDisconnect(ctx context.Context, msg OkMessage) error
PublishDisconnect will publish messages to '/disconnect' channel
func (*AppController) SubscribeAll ¶
func (c *AppController) SubscribeAll(ctx context.Context, as AppSubscriber) error
SubscribeAll will subscribe to channels without parameters on which the app is expecting messages. For channels with parameters, they should be subscribed independently.
func (*AppController) SubscribeDisconnect ¶
func (c *AppController) SubscribeDisconnect(ctx context.Context, fn func(ctx context.Context, msg OkMessage)) error
SubscribeDisconnect will subscribe to new messages from '/disconnect' channel.
Callback function 'fn' will be called each time a new message is received.
func (*AppController) SubscribeFoo ¶
func (c *AppController) SubscribeFoo(ctx context.Context, fn func(ctx context.Context, msg FooMessage)) error
Callback function 'fn' will be called each time a new message is received.
func (*AppController) UnsubscribeAll ¶
func (c *AppController) UnsubscribeAll(ctx context.Context)
UnsubscribeAll will unsubscribe all remaining subscribed channels
func (*AppController) UnsubscribeDisconnect ¶
func (c *AppController) UnsubscribeDisconnect(ctx context.Context)
UnsubscribeDisconnect will unsubscribe messages from '/disconnect' channel. A timeout can be set in context to avoid blocking operation, if needed.
func (*AppController) UnsubscribeFoo ¶
func (c *AppController) UnsubscribeFoo(ctx context.Context)
UnsubscribeFoo will unsubscribe messages from '/foo' channel. A timeout can be set in context to avoid blocking operation, if needed.
type AppSubscriber ¶
type AppSubscriber interface {
// Disconnect subscribes to messages placed on the '/disconnect' channel
Disconnect(ctx context.Context, msg OkMessage)
// Foo subscribes to messages placed on the '/foo' channel
Foo(ctx context.Context, msg FooMessage)
}
AppSubscriber represents all handlers that are expecting messages for App
type ControllerOption ¶
type ControllerOption func(controller *controller)
ControllerOption is the type of the options that can be passed when creating a new Controller
func WithLogger ¶
func WithLogger(logger extensions.Logger) ControllerOption
WithLogger attaches a logger to the controller
func WithMiddlewares ¶
func WithMiddlewares(middlewares ...extensions.Middleware) ControllerOption
WithMiddlewares attaches middlewares that will be executed when sending or receiving messages
type FooMessage ¶
type FooMessage struct {
// Payload will be inserted in the message payload
Payload struct {
// Description: Age of the person.
Age *int64 `json:"age"`
// Description: Indicates if the person is female.
Female *bool `json:"female"`
// Description: Name of the person.
Name *string `json:"name"`
}
}
FooMessage is the message expected for 'Foo' channel
func NewFooMessage ¶
func NewFooMessage() FooMessage
type OkMessage ¶
type OkMessage struct {
// Payload will be inserted in the message payload
Payload ActionSchema
}
OkMessage is the message expected for 'Ok' channel
func NewOkMessage ¶
func NewOkMessage() OkMessage
type PersonSchema ¶
type PersonSchema struct {
Action *string `json2:"action-Boy"`
AdditionalProperty *string `json:"additional_property"`
}
PersonSchema is a schema from the AsyncAPI specification required in messages
type RegistrationSchema ¶
type RegistrationSchema struct {
CallId *string `json:"call_id"`
}
RegistrationSchema is a schema from the AsyncAPI specification required in messages
type UserController ¶
type UserController struct {
// contains filtered or unexported fields
}
UserController is the structure that provides publishing capabilities to the developer and and connect the broker with the User
func NewUserController ¶
func NewUserController(bc extensions.BrokerController, options ...ControllerOption) (*UserController, error)
NewUserController links the User to the broker
func (*UserController) Close ¶
func (c *UserController) Close(ctx context.Context)
Close will clean up any existing resources on the controller
func (*UserController) PublishDisconnect ¶
func (c *UserController) PublishDisconnect(ctx context.Context, msg OkMessage) error
PublishDisconnect will publish messages to '/disconnect' channel
func (*UserController) PublishFoo ¶
func (c *UserController) PublishFoo(ctx context.Context, msg FooMessage) error
PublishFoo will publish messages to '/foo' channel
func (*UserController) SubscribeAll ¶
func (c *UserController) SubscribeAll(ctx context.Context, as UserSubscriber) error
SubscribeAll will subscribe to channels without parameters on which the app is expecting messages. For channels with parameters, they should be subscribed independently.
func (*UserController) SubscribeDisconnect ¶
func (c *UserController) SubscribeDisconnect(ctx context.Context, fn func(ctx context.Context, msg OkMessage)) error
SubscribeDisconnect will subscribe to new messages from '/disconnect' channel.
Callback function 'fn' will be called each time a new message is received.
func (*UserController) UnsubscribeAll ¶
func (c *UserController) UnsubscribeAll(ctx context.Context)
UnsubscribeAll will unsubscribe all remaining subscribed channels
func (*UserController) UnsubscribeDisconnect ¶
func (c *UserController) UnsubscribeDisconnect(ctx context.Context)
UnsubscribeDisconnect will unsubscribe messages from '/disconnect' channel. A timeout can be set in context to avoid blocking operation, if needed.
type UserSchema ¶
type UserSchema struct {
Action *string `json2:"action-Boy"`
AdditionalProperty *string `json:"additional_property"`
}
UserSchema is a schema from the AsyncAPI specification required in messages
type UserSubscriber ¶
type UserSubscriber interface {
// Disconnect subscribes to messages placed on the '/disconnect' channel
Disconnect(ctx context.Context, msg OkMessage)
}
UserSubscriber represents all handlers that are expecting messages for User