Class CreateTableMonitorRequest

  • All Implemented Interfaces:
    org.apache.avro.generic.GenericContainer, org.apache.avro.generic.IndexedRecord

    public class CreateTableMonitorRequest
    extends Object
    implements org.apache.avro.generic.IndexedRecord
    A set of parameters for GPUdb.createTableMonitor.

    Creates a monitor that watches for a single table modification event type (insert, update, or delete) on a particular table (identified by tableName) and forwards event notifications to subscribers via ZMQ. After this call completes, subscribe to the returned topicId on the ZMQ table monitor port (default 9002). Each time an operation of the given type on the table completes, a multipart message is published for that topic; the first part contains only the topic ID, and each subsequent part contains one binary-encoded Avro object that corresponds to the event and can be decoded using typeSchema. The monitor will continue to run (regardless of whether or not there are any subscribers) until deactivated with GPUdb.clearTableMonitor.

    For more information on table monitors, see Table Monitors.

    • Constructor Detail

      • CreateTableMonitorRequest

        public CreateTableMonitorRequest()
        Constructs a CreateTableMonitorRequest object with default parameters.
      • CreateTableMonitorRequest

        public CreateTableMonitorRequest​(String tableName,
                                         Map<String,​String> options)
        Constructs a CreateTableMonitorRequest object with the specified parameters.
        Parameters:
        tableName - Name of the table to monitor, in [schema_name.]table_name format, using standard name resolution rules.
        options - Optional parameters.
        • EVENT: Type of modification event on the target table to be monitored by this table monitor. Supported values:
          • INSERT: Get notifications of new record insertions. The new row images are forwarded to the subscribers.
          • UPDATE: Get notifications of update operations. The modified row count information is forwarded to the subscribers.
          • DELETE: Get notifications of delete operations. The deleted row count information is forwarded to the subscribers.
          The default value is INSERT.
        • MONITOR_ID: ID to use for this monitor instead of a randomly generated one
        • DATASINK_NAME: Name of an existing data sink to send change data notifications to
        • DESTINATION: Destination for the output data in format 'destination_type://path[:port]'. Supported destination types are 'http', 'https' and 'kafka'.
        • KAFKA_TOPIC_NAME: Name of the Kafka topic to publish to if DESTINATION in options is specified and is a Kafka broker
        • INCREASING_COLUMN: Column on subscribed table that will increase for new records (e.g., TIMESTAMP).
        • EXPRESSION: Filter expression to limit records for notification
        • JOIN_TABLE_NAMES: A comma-separated list of tables (optionally with aliases) to include in the join. The monitored table tableName must be included, representing only the newly inserted rows (deltas) since the last notification. Other tables can be any existing tables or views. Aliases can be used with the 'table_name as alias' syntax.
        • JOIN_COLUMN_NAMES: A comma-separated list of columns or expressions to include from the joined tables. Column references can use table names or aliases defined in 'join_table_names'. Each column can optionally be aliased using 'as'. The selected columns will also appear in the notification output.
        • JOIN_EXPRESSIONS: Optional filter or join expressions to apply when combining the tables. Expressions are standard SQL-style conditions and can reference any table or alias listed in 'join_table_names'. This corresponds to the WHERE clause of the underlying join, and can include conditions to filter the delta rows.
        • REFRESH_METHOD: Method controlling when the table monitor reports changes to the tableName. Supported values: The default value is ON_CHANGE.
        • REFRESH_PERIOD: When REFRESH_METHOD is PERIODIC, specifies the period in seconds at which changes are reported.
        • REFRESH_START_TIME: When REFRESH_METHOD is PERIODIC, specifies the first time at which changes are reported. Value is a datetime string with format 'YYYY-MM-DD HH:MM:SS'.
        The default value is an empty Map.
    • Method Detail

      • getClassSchema

        public static org.apache.avro.Schema getClassSchema()
        This method supports the Avro framework and is not intended to be called directly by the user.
        Returns:
        The schema for the class.
      • getTableName

        public String getTableName()
        Name of the table to monitor, in [schema_name.]table_name format, using standard name resolution rules.
        Returns:
        The current value of tableName.
      • setTableName

        public CreateTableMonitorRequest setTableName​(String tableName)
        Name of the table to monitor, in [schema_name.]table_name format, using standard name resolution rules.
        Parameters:
        tableName - The new value for tableName.
        Returns:
        this to mimic the builder pattern.
      • getOptions

        public Map<String,​String> getOptions()
        Optional parameters.
        • EVENT: Type of modification event on the target table to be monitored by this table monitor. Supported values:
          • INSERT: Get notifications of new record insertions. The new row images are forwarded to the subscribers.
          • UPDATE: Get notifications of update operations. The modified row count information is forwarded to the subscribers.
          • DELETE: Get notifications of delete operations. The deleted row count information is forwarded to the subscribers.
          The default value is INSERT.
        • MONITOR_ID: ID to use for this monitor instead of a randomly generated one
        • DATASINK_NAME: Name of an existing data sink to send change data notifications to
        • DESTINATION: Destination for the output data in format 'destination_type://path[:port]'. Supported destination types are 'http', 'https' and 'kafka'.
        • KAFKA_TOPIC_NAME: Name of the Kafka topic to publish to if DESTINATION in options is specified and is a Kafka broker
        • INCREASING_COLUMN: Column on subscribed table that will increase for new records (e.g., TIMESTAMP).
        • EXPRESSION: Filter expression to limit records for notification
        • JOIN_TABLE_NAMES: A comma-separated list of tables (optionally with aliases) to include in the join. The monitored table tableName must be included, representing only the newly inserted rows (deltas) since the last notification. Other tables can be any existing tables or views. Aliases can be used with the 'table_name as alias' syntax.
        • JOIN_COLUMN_NAMES: A comma-separated list of columns or expressions to include from the joined tables. Column references can use table names or aliases defined in 'join_table_names'. Each column can optionally be aliased using 'as'. The selected columns will also appear in the notification output.
        • JOIN_EXPRESSIONS: Optional filter or join expressions to apply when combining the tables. Expressions are standard SQL-style conditions and can reference any table or alias listed in 'join_table_names'. This corresponds to the WHERE clause of the underlying join, and can include conditions to filter the delta rows.
        • REFRESH_METHOD: Method controlling when the table monitor reports changes to the tableName. Supported values: The default value is ON_CHANGE.
        • REFRESH_PERIOD: When REFRESH_METHOD is PERIODIC, specifies the period in seconds at which changes are reported.
        • REFRESH_START_TIME: When REFRESH_METHOD is PERIODIC, specifies the first time at which changes are reported. Value is a datetime string with format 'YYYY-MM-DD HH:MM:SS'.
        The default value is an empty Map.
        Returns:
        The current value of options.
      • setOptions

        public CreateTableMonitorRequest setOptions​(Map<String,​String> options)
        Optional parameters.
        • EVENT: Type of modification event on the target table to be monitored by this table monitor. Supported values:
          • INSERT: Get notifications of new record insertions. The new row images are forwarded to the subscribers.
          • UPDATE: Get notifications of update operations. The modified row count information is forwarded to the subscribers.
          • DELETE: Get notifications of delete operations. The deleted row count information is forwarded to the subscribers.
          The default value is INSERT.
        • MONITOR_ID: ID to use for this monitor instead of a randomly generated one
        • DATASINK_NAME: Name of an existing data sink to send change data notifications to
        • DESTINATION: Destination for the output data in format 'destination_type://path[:port]'. Supported destination types are 'http', 'https' and 'kafka'.
        • KAFKA_TOPIC_NAME: Name of the Kafka topic to publish to if DESTINATION in options is specified and is a Kafka broker
        • INCREASING_COLUMN: Column on subscribed table that will increase for new records (e.g., TIMESTAMP).
        • EXPRESSION: Filter expression to limit records for notification
        • JOIN_TABLE_NAMES: A comma-separated list of tables (optionally with aliases) to include in the join. The monitored table tableName must be included, representing only the newly inserted rows (deltas) since the last notification. Other tables can be any existing tables or views. Aliases can be used with the 'table_name as alias' syntax.
        • JOIN_COLUMN_NAMES: A comma-separated list of columns or expressions to include from the joined tables. Column references can use table names or aliases defined in 'join_table_names'. Each column can optionally be aliased using 'as'. The selected columns will also appear in the notification output.
        • JOIN_EXPRESSIONS: Optional filter or join expressions to apply when combining the tables. Expressions are standard SQL-style conditions and can reference any table or alias listed in 'join_table_names'. This corresponds to the WHERE clause of the underlying join, and can include conditions to filter the delta rows.
        • REFRESH_METHOD: Method controlling when the table monitor reports changes to the tableName. Supported values: The default value is ON_CHANGE.
        • REFRESH_PERIOD: When REFRESH_METHOD is PERIODIC, specifies the period in seconds at which changes are reported.
        • REFRESH_START_TIME: When REFRESH_METHOD is PERIODIC, specifies the first time at which changes are reported. Value is a datetime string with format 'YYYY-MM-DD HH:MM:SS'.
        The default value is an empty Map.
        Parameters:
        options - The new value for options.
        Returns:
        this to mimic the builder pattern.
      • getSchema

        public org.apache.avro.Schema getSchema()
        This method supports the Avro framework and is not intended to be called directly by the user.
        Specified by:
        getSchema in interface org.apache.avro.generic.GenericContainer
        Returns:
        The schema object describing this class.
      • get

        public Object get​(int index)
        This method supports the Avro framework and is not intended to be called directly by the user.
        Specified by:
        get in interface org.apache.avro.generic.IndexedRecord
        Parameters:
        index - the position of the field to get
        Returns:
        value of the field with the given index.
        Throws:
        IndexOutOfBoundsException
      • put

        public void put​(int index,
                        Object value)
        This method supports the Avro framework and is not intended to be called directly by the user.
        Specified by:
        put in interface org.apache.avro.generic.IndexedRecord
        Parameters:
        index - the position of the field to set
        value - the value to set
        Throws:
        IndexOutOfBoundsException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object