Documentation ¶
Overview ¶
Package pubsub is the GCP PubSub implementation of an event stream.
Index ¶
Examples ¶
Constants ¶
View Source
const ( // TopicNameOption is the topic name option. TopicNameOption = "topic_name" // OrderingKeyOption is the ordering key option. OrderingKeyOption = "ordering_key" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pubsub ¶
type Pubsub struct {
// contains filtered or unexported fields
}
Pubsub is the wrapper for the Pubsub library.
func New ¶
New creates a new instance of Kinesis.
Example ¶
package main import ( "context" "fmt" "os" pubsubraw "cloud.google.com/go/pubsub" "github.com/artsv79/outboxer" "github.com/artsv79/outboxer/es/pubsub" ) func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() client, err := pubsubraw.NewClient(ctx, os.Getenv("GCP_PROJECT_ID")) if err != nil { fmt.Printf("failed to connect to gcp: %s", err) return } es := pubsub.New(client) // this is done internally by outboxer if err := es.Send(ctx, &outboxer.OutboxMessage{ Payload: []byte("test payload"), Options: map[string]interface{}{ pubsub.TopicNameOption: "test", pubsub.OrderingKeyOption: "order", }, }); err != nil { fmt.Printf("an error was not expected: %s", err) return } }
Output:
Click to show internal directories.
Click to hide internal directories.