Skip to content

Commit

Permalink
Minor change to examples for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdiep committed Dec 23, 2020
1 parent 4fbb3a1 commit 86dd6c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pubsublite/ps/example_test.go
Expand Up @@ -76,12 +76,12 @@ func ExamplePublisherClient_Error() {
func ExampleSubscriberClient_Receive() {
ctx := context.Background()
subscription := pubsublite.SubscriptionPath{Project: "project-id", Zone: "zone", SubscriptionID: "subscription-id"}
sub, err := ps.NewSubscriberClient(ctx, ps.DefaultReceiveSettings, subscription)
subscriber, err := ps.NewSubscriberClient(ctx, ps.DefaultReceiveSettings, subscription)
if err != nil {
// TODO: Handle error.
}
cctx, cancel := context.WithCancel(ctx)
err = sub.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
// TODO: Handle message.
// NOTE: May be called concurrently; synchronize access to shared memory.
m.Ack()
Expand All @@ -105,12 +105,12 @@ func ExampleSubscriberClient_Receive_maxOutstanding() {
settings := ps.DefaultReceiveSettings
settings.MaxOutstandingMessages = 5
settings.MaxOutstandingBytes = 10e6
sub, err := ps.NewSubscriberClient(ctx, settings, subscription)
subscriber, err := ps.NewSubscriberClient(ctx, settings, subscription)
if err != nil {
// TODO: Handle error.
}
cctx, cancel := context.WithCancel(ctx)
err = sub.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
// TODO: Handle message.
// NOTE: May be called concurrently; synchronize access to shared memory.
m.Ack()
Expand Down

0 comments on commit 86dd6c2

Please sign in to comment.