Documentation
¶
Overview ¶
Package gcppubsubevents provides a Google Pub/Sub-backed events transport driver.
Index ¶
- type Config
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) Driver() eventscore.Driver
- func (d *Driver) PublishContext(ctx context.Context, msg eventscore.Message) error
- func (d *Driver) Ready(ctx context.Context) error
- func (d *Driver) SubscribeContext(ctx context.Context, topic string, handler eventscore.MessageHandler) (eventscore.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config configures Google Pub/Sub transport construction. @group Config
Example: define Google Pub/Sub driver config
cfg := gcppubsubevents.Config{
ProjectID: "events-project",
URI: "127.0.0.1:8085",
}
_ = cfg
Example: define Google Pub/Sub driver config with all fields
cfg := gcppubsubevents.Config{
ProjectID: "events-project",
URI: "127.0.0.1:8085", // default: "" is invalid unless Client is provided
Client: nil, // default: nil creates a client from ProjectID and URI
}
_ = cfg
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is a Google Pub/Sub-backed events transport. @group Drivers
Example: keep a Google Pub/Sub driver reference
var driver *gcppubsubevents.Driver fmt.Println(driver == nil) // Output: true
func New ¶
New constructs a Google Pub/Sub-backed driver. @group Driver Constructors
Example: construct a Google Pub/Sub driver
driver, _ := gcppubsubevents.New(context.Background(), gcppubsubevents.Config{
ProjectID: "events-project",
URI: "127.0.0.1:8085",
})
_ = driver
func (*Driver) Driver ¶
func (d *Driver) Driver() eventscore.Driver
Driver reports the active backend kind. @group Drivers
func (*Driver) PublishContext ¶
PublishContext publishes a topic payload to Google Pub/Sub. @group Drivers
func (*Driver) SubscribeContext ¶
func (d *Driver) SubscribeContext(ctx context.Context, topic string, handler eventscore.MessageHandler) (eventscore.Subscription, error)
SubscribeContext subscribes to a Google Pub/Sub topic and forwards messages. @group Drivers