View Javadoc
1   package org.wikimedia.eventutilities.flink.formats.json;
2   
3   import java.util.List;
4   import java.util.Map;
5   
6   import org.apache.flink.configuration.ConfigOption;
7   import org.apache.flink.configuration.ConfigOptions;
8   import org.apache.flink.formats.json.JsonFormatOptions;
9   
10  import com.google.common.collect.ImmutableList;
11  import com.google.common.collect.ImmutableMap;
12  
13  public final class EventJsonFormatOptions {
14  
15      public static final ConfigOption<List<String>> EVENT_SCHEMAS_BASE_URIS =
16          ConfigOptions.key("event-schema-base-uris")
17              .stringType()
18              .asList()
19              .noDefaultValue()
20              .withDescription(
21                  "URIs from which to fetch event JSONSchemas.");
22  
23      public static final ConfigOption<String> EVENT_STREAM_CONFIG_URI =
24          ConfigOptions.key("event-stream-config-uri")
25              .stringType()
26              .noDefaultValue()
27              .withDescription(
28                  "URI from which to fetch event stream config."
29              );
30  
31      public static final ConfigOption<String> STREAM_NAME =
32          ConfigOptions.key("event-stream-name")
33              .stringType()
34              .noDefaultValue()
35              .withDescription(
36                  "The event stream to fetch the schema for."
37              );
38  
39      public static final ConfigOption<String> SCHEMA_VERSION =
40          ConfigOptions.key("event-schema-version")
41              .stringType()
42              .noDefaultValue()
43              .withDescription(
44                  "Filled on a per-table basis either automatically through the catalog or manually using CREATE."
45              );
46  
47      public static final ConfigOption<Map<String, String>> HTTP_ROUTES =
48          ConfigOptions.key("http-routes")
49              .mapType()
50              .noDefaultValue()
51              .withDescription(
52                  "Sets http routing for EventStreamFactory"
53              );
54  
55      public static final ImmutableList<ConfigOption<?>> FORWARD_OPTIONS = ImmutableList.of(
56          EVENT_SCHEMAS_BASE_URIS,
57          EVENT_STREAM_CONFIG_URI,
58          STREAM_NAME,
59          SCHEMA_VERSION,
60          HTTP_ROUTES
61      );
62  
63      /**
64       * Default options that are applied to every table with event-json format that is created.
65       */
66      public static final ImmutableMap<String, String> DEFAULT_FORMAT_OPTIONS = ImmutableMap.<String, String>builder()
67          .put(EventJsonFormatFactory.IDENTIFIER + "." + JsonFormatOptions.TIMESTAMP_FORMAT.key(), "ISO-8601")
68          .build();
69  
70      private EventJsonFormatOptions() {
71      }
72  }