15
15
*/
16
16
17
17
/*
18
- * Purge user events into a catalog from inline source using Retail API
18
+ * Deleting user event using Retail API.
19
19
*/
20
20
21
21
package events ;
@@ -36,11 +36,11 @@ public class PurgeUserEvent {
36
36
37
37
public static void main (String [] args )
38
38
throws IOException , ExecutionException , InterruptedException {
39
- // TODO(developer): Replace these variables before running the sample .
39
+ // TODO(developer): Set projectId to your Google Cloud Platform project ID .
40
40
String projectId = ServiceOptions .getDefaultProjectId ();
41
41
String defaultCatalog =
42
42
String .format ("projects/%s/locations/global/catalogs/default_catalog" , projectId );
43
- // visitorId generated randomly.
43
+ // visitorId is generated randomly
44
44
String visitorId = UUID .randomUUID ().toString ();
45
45
46
46
callPurgeUserEvents (defaultCatalog , visitorId );
@@ -57,9 +57,11 @@ public static void callPurgeUserEvents(String defaultCatalog, String visitorId)
57
57
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient .create ()) {
58
58
PurgeUserEventsRequest purgeUserEventsRequest =
59
59
PurgeUserEventsRequest .newBuilder ()
60
- // TO CHECK ERROR HANDLING SET INVALID FILTER HERE :
60
+ // To check error handling set invalid filter here :
61
61
.setFilter (String .format ("visitorId=\" %s\" " , visitorId ))
62
62
.setParent (defaultCatalog )
63
+ // Setting the force field to true deletes user events. If set to false will return
64
+ // number of events to be deleted without actually deleting them
63
65
.setForce (true )
64
66
.build ();
65
67
System .out .printf ("Purge user events request: %s%n" , purgeUserEventsRequest );
0 commit comments