|
27 | 27 |
|
28 | 28 | public class CreateFeedExample {
|
29 | 29 | // Create a feed
|
30 |
| - public static void createFeed( |
31 |
| - String[] assetNames, String feedId, String topic, String projectId) throws Exception { |
| 30 | + public static void createFeed(String[] assetNames, String feedId, String topic, String projectId) |
| 31 | + throws Exception { |
32 | 32 | // String[] assetNames = {"MY_ASSET_NAME"}
|
33 | 33 | // String FeedId = "MY_FEED_ID"
|
34 | 34 | // String topic = "projects/[PROJECT_ID]/topics/[TOPIC_NAME]"
|
35 | 35 | // String projectID = "MY_PROJECT_ID"
|
36 |
| - Feed feed = Feed.newBuilder() |
37 |
| - .addAllAssetNames(Arrays.asList(assetNames)) |
38 |
| - .setFeedOutputConfig( |
39 |
| - FeedOutputConfig.newBuilder().setPubsubDestination( |
40 |
| - PubsubDestination.newBuilder().setTopic(topic).build()).build()).build(); |
41 |
| - CreateFeedRequest request = CreateFeedRequest.newBuilder() |
42 |
| - .setParent(String.format(ProjectName.of(projectId).toString())) |
43 |
| - .setFeedId(feedId) |
44 |
| - .setFeed(feed) |
45 |
| - .build(); |
| 36 | + Feed feed = |
| 37 | + Feed.newBuilder() |
| 38 | + .addAllAssetNames(Arrays.asList(assetNames)) |
| 39 | + .setFeedOutputConfig( |
| 40 | + FeedOutputConfig.newBuilder() |
| 41 | + .setPubsubDestination(PubsubDestination.newBuilder().setTopic(topic).build()) |
| 42 | + .build()) |
| 43 | + .build(); |
| 44 | + CreateFeedRequest request = |
| 45 | + CreateFeedRequest.newBuilder() |
| 46 | + .setParent(String.format(ProjectName.of(projectId).toString())) |
| 47 | + .setFeedId(feedId) |
| 48 | + .setFeed(feed) |
| 49 | + .build(); |
46 | 50 | // Initialize client that will be used to send requests. This client only needs to be created
|
47 | 51 | // once, and can be reused for multiple requests. After completing all of your requests, call
|
48 | 52 | // the "close" method on the client to safely clean up any remaining background resources.
|
|
0 commit comments