Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/vendor/cloud.google.com/go/pubsub
Kaviraj 6cc41f92f8
Gcplog targetmanager (#3083)
4 years ago
..
apiv1 Gcplog targetmanager (#3083) 4 years ago
internal/distribution Gcplog targetmanager (#3083) 4 years ago
pstest Gcplog targetmanager (#3083) 4 years ago
CHANGES.md Gcplog targetmanager (#3083) 4 years ago
LICENSE Gcplog targetmanager (#3083) 4 years ago
README.md Gcplog targetmanager (#3083) 4 years ago
debug.go Gcplog targetmanager (#3083) 4 years ago
doc.go Gcplog targetmanager (#3083) 4 years ago
flow_controller.go Gcplog targetmanager (#3083) 4 years ago
go.mod Gcplog targetmanager (#3083) 4 years ago
go.sum Gcplog targetmanager (#3083) 4 years ago
go_mod_tidy_hack.go Gcplog targetmanager (#3083) 4 years ago
iterator.go Gcplog targetmanager (#3083) 4 years ago
message.go Gcplog targetmanager (#3083) 4 years ago
nodebug.go Gcplog targetmanager (#3083) 4 years ago
pubsub.go Gcplog targetmanager (#3083) 4 years ago
pullstream.go Gcplog targetmanager (#3083) 4 years ago
service.go Gcplog targetmanager (#3083) 4 years ago
snapshot.go Gcplog targetmanager (#3083) 4 years ago
subscription.go Gcplog targetmanager (#3083) 4 years ago
topic.go Gcplog targetmanager (#3083) 4 years ago
trace.go Gcplog targetmanager (#3083) 4 years ago

README.md

Cloud Pub/Sub GoDoc

Example Usage

First create a pubsub.Client to use throughout your application:

client, err := pubsub.NewClient(ctx, "project-id")
if err != nil {
	log.Fatal(err)
}

Then use the client to publish and subscribe:

// Publish "hello world" on topic1.
topic := client.Topic("topic1")
res := topic.Publish(ctx, &pubsub.Message{
	Data: []byte("hello world"),
})
// The publish happens asynchronously.
// Later, you can get the result from res:
...
msgID, err := res.Get(ctx)
if err != nil {
	log.Fatal(err)
}

// Use a callback to receive messages via subscription1.
sub := client.Subscription("subscription1")
err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
	fmt.Println(m.Data)
	m.Ack() // Acknowledge that we've consumed the message.
})
if err != nil {
	log.Println(err)
}