@@ -161,7 +161,7 @@ public static void deleteOccurrence(String occurrenceName) throws Exception {
161
161
162
162
// [START get_occurrence]
163
163
/**
164
- * Retrieves an occurrence based on it's name
164
+ * Retrieves an occurrence based on its name
165
165
*
166
166
* @param occurrenceName the name of the occurrence to delete
167
167
* format: "projects/{projectId}/occurrences/{occurrence_id}"
@@ -177,7 +177,7 @@ public static Occurrence getOccurrence(String occurrenceName) throws Exception
177
177
178
178
// [START get_note]
179
179
/**
180
- * Retrieves a note based on it's noteId and projectId
180
+ * Retrieves a note based on its noteId and projectId
181
181
*
182
182
* @param noteId the note's unique identifier
183
183
* @param projectId the project's unique identifier
@@ -280,22 +280,22 @@ public static int getOccurrencesForImage(String imageUrl, String projectId) thro
280
280
// [START pubsub]
281
281
/**
282
282
* Handle incoming occurrences using a pubsub subscription
283
- * @param subscriptionId the user-specified identifier for the pubsub subscription
283
+ * @param subId the user-specified identifier for the pubsub subscription
284
284
* @param timeout the amount of time to listen for pubsub messages (in seconds)
285
285
* @param projectId the project's unique identifier
286
286
* @return number of occurrence pubsub messages received
287
287
* @throws Exception on errors with the subscription client
288
288
*/
289
- public static int pubSub (String subscriptionId , int timeout , String projectId ) throws Exception {
289
+ public static int pubSub (String subId , int timeout , String projectId ) throws Exception {
290
290
Subscriber subscriber = null ;
291
291
MessageReceiverExample receiver = new MessageReceiverExample ();
292
292
293
293
try {
294
294
// subscribe to the requested pubsub channel
295
- ProjectSubscriptionName subscriptionName = ProjectSubscriptionName .of (projectId , subscriptionId );
296
- subscriber = Subscriber .newBuilder (subscriptionName , receiver ).build ();
295
+ ProjectSubscriptionName subName = ProjectSubscriptionName .of (projectId , subId );
296
+ subscriber = Subscriber .newBuilder (subName , receiver ).build ();
297
297
subscriber .startAsync ().awaitRunning ();
298
- // listen to messages for 'listenTimeout ' seconds
298
+ // listen to messages for 'timeout ' seconds
299
299
for (int i = 0 ; i < timeout ; i ++) {
300
300
sleep (1000 );
301
301
}
@@ -330,20 +330,20 @@ public synchronized void receiveMessage(PubsubMessage message, AckReplyConsumer
330
330
331
331
/**
332
332
* Creates and returns a pubsub subscription object listening to the occurrence topic
333
- * @param subscriptionId the identifier you want to associate with the subscription
333
+ * @param subId the identifier you want to associate with the subscription
334
334
* @param projectId the project's unique identifier
335
335
* @throws Exception on errors with the subscription client
336
336
*/
337
- public static Subscription createOccurrenceSubscription (String subscriptionId , String projectId )
337
+ public static Subscription createOccurrenceSubscription (String subId , String projectId )
338
338
throws Exception {
339
339
String topicId = "resource-notes-occurrences-v1alpha1" ;
340
340
try (SubscriptionAdminClient client = SubscriptionAdminClient .create ()) {
341
341
PushConfig config = PushConfig .getDefaultInstance ();
342
342
ProjectTopicName topicName = ProjectTopicName .of (projectId , topicId );
343
- ProjectSubscriptionName subscriptionName = ProjectSubscriptionName .of (projectId , subscriptionId );
344
- Subscription sub = client .createSubscription (subscriptionName , topicName , config , 0 );
343
+ ProjectSubscriptionName subName = ProjectSubscriptionName .of (projectId , subId );
344
+ Subscription sub = client .createSubscription (subName , topicName , config , 0 );
345
345
return sub ;
346
346
}
347
347
}
348
348
// [END pubsub]
349
- }
349
+ }
0 commit comments