Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubsubMsgBroker ¶
type PubsubMsgBroker struct {
// contains filtered or unexported fields
}
PubsubMsgBroker is an implementation of MsgBroker for Google PubSub.
func New ¶
func New(projectID, apiKey, topicPrefix, subsName string) (*PubsubMsgBroker, error)
New returns a new *PubsubMsgBroker.
func NewMetered ¶
func NewMetered(projectID, apiKey, topicPrefix, subsName string, meter metric.MeterMust) (*PubsubMsgBroker, error)
NewMetered is the same as New but exporting some metrics.
func (*PubsubMsgBroker) PublishMsg ¶
func (p *PubsubMsgBroker) PublishMsg(ctx context.Context, tname mbroker.TopicName, data []byte) (err error)
PublishMsg publishes a payload to a topic. If the topic doesn't exist, it's created. The topic name is the same as described in RegisterTopicHandler method documentation.
func (*PubsubMsgBroker) RegisterTopicHandler ¶
func (p *PubsubMsgBroker) RegisterTopicHandler( tname mbroker.TopicName, handler mbroker.TopicHandler, opts ...mbroker.Option) error
RegisterTopicHandler registers a handler for a topic.
- If the topic doesn't exist in PubSub, it's automatically created. The topic name is defined as '<topic-prefix>-<topic-name>'.
- If a subscription doesn't exist in PubSub it's automatically created. The subscription name is defined as '<topic-prefix>-<topic-name>-<subs-name>' (e.g: "staging-new-batch-created-brokerd")
Click to show internal directories.
Click to hide internal directories.