public class ExampleUtils extends Object
It is used to run Beam examples.
| Constructor and Description |
|---|
ExampleUtils(PipelineOptions options)
Do resources and runner options setup.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setup()
Sets up external resources that are required by the example,
such as Pub/Sub topics and BigQuery tables.
|
void |
setupBigQueryTable()
Sets up the BigQuery table with the given schema.
|
void |
setupPubsub()
Sets up the Google Cloud Pub/Sub topic.
|
void |
waitToFinish(PipelineResult result)
If DataflowRunner or BlockingDataflowRunner is used,
waits for the pipeline to finish and cancels it (and the injector) before the program exists.
|
public ExampleUtils(PipelineOptions options)
public void setup()
throws IOException
IOException - if there is a problem setting up the resourcespublic void setupPubsub()
throws IOException
If the topic doesn't exist, a new topic with the given name will be created.
IOException - if there is a problem setting up the Pub/Sub topicpublic void setupBigQueryTable()
throws IOException
If the table already exists, the schema has to match the given one. Otherwise, the example will throw a RuntimeException. If the table doesn't exist, a new table with the given schema will be created.
IOException - if there is a problem setting up the BigQuery tablepublic void waitToFinish(PipelineResult result)