public class ExampleUtils
extends java.lang.Object
It is used to run Beam examples.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TOKENIZER_PATTERN
\p{L} denotes the category of Unicode letters, so this pattern will match on everything that is
not a letter.
|
| Constructor and Description |
|---|
ExampleUtils(org.apache.beam.sdk.options.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(org.apache.beam.sdk.PipelineResult result)
Waits for the pipeline to finish and cancels it before the program exists.
|
public static final java.lang.String TOKENIZER_PATTERN
It is used for tokenizing strings in the wordcount examples.
public ExampleUtils(org.apache.beam.sdk.options.PipelineOptions options)
public void setup()
throws java.io.IOException
java.io.IOException - if there is a problem setting up the resourcespublic void setupPubsub()
throws java.io.IOException
If the topic doesn't exist, a new topic with the given name will be created.
java.io.IOException - if there is a problem setting up the Pub/Sub topicpublic void setupBigQueryTable()
throws java.io.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.
java.io.IOException - if there is a problem setting up the BigQuery tablepublic void waitToFinish(org.apache.beam.sdk.PipelineResult result)