Adapter for Apache Kafka 9.6 | webMethods Adapter for Apache Kafka Documentation | webMethods Adapter for Apache Kafka Installation and User’s Documentation | Adapter Services | Configuring Persistent Query Services
 
Configuring Persistent Query Services
A Persistent Query service creates a KSQL stream or table that contains results of a SELECT query from an existing stream or table. You configure Adapter for Apache Kafka services using Designer. For more information about adapter services, see Using Adapter Services.
Be sure to review the section Before Configuring or Managing Adapter Services before you configure adapter services.
*To configure a Select service
1. In Designer, right-click the package in which the service should be contained and select New > Adapter Service.
2. Select the parent namespace, type a name for the adapter service, and click Next.
3. Select Adapter for Apache Kafka as the adapter type and click Next.
4. Select the appropriate KSQL connection type as Adapter Connection Name and click Next.
5. From the list of available templates, select the Persistent Query template and click Finish.
The adapter service editor for the adapter service appears. You can select the Adapter Settings tab at any time to confirm adapter service properties such as the Adapter Name, Adapter Connection Name, and Adapter Service Template, as necessary.
6. Select the Create tab to configure stream or table using the following fields:
Field
Description/Action
Type
Defines the source type, that is, Stream or Table.
Name
Name of the table or stream to be selected.
Topics
Displays the available topics in the back-end.
Value Format
Data stored in different formats such as JSON, AVRO, DELIMITED.
7. Select the From tab for creating a new stream or table out of the selected streams or tables using the following fields:
Field
Description/Action
Alias
The alias for table or stream is assigned automatically when you select more than one table or stream in the Name field. The default value is t1.
Note:
There cannot be more than two tables. It can be a combination of one stream and one table.
Name
Select a table or a stream name.
Type
Defines the source type you select, that is, table or stream.
8. If you are not joining tables, skip this step. Select the JOIN tab to specify the columns for joining the tables you just configured.
a. Select the icon to create new left columns.
b. Select Left Column and select the first table's joining column.
c. Select the appropriate Operator.
d. Select Right Column and select the next table's joining column.
e. When you join two streams, WITHIN must be specified.
Use the following fields:
Field
Description/Action
WITHIN Type
Fixed or Interval.
If you select Fixed as WITHIN Type, then the 'within' type integer will appear under input parameters of the service. This is equivalent to WITHIN N Timeunit.
If you select Interval as WITHIN Type, then the 'within' type document will have before and after runtime parameters. This is equivalent to WITHIN(before Timeunit, after Timeunit).
WITHIN Timeunit
The time unit for the window. Valid values like DAY, DAYS, HOUR, HOURS, SECONDS and so on.
9. Use the SELECT tab to define the columns and fields to be selected as follows:
a. Use the icon to create new rows as needed. You can use the icon to fill in all rows to the table.
b. As you insert additional rows, the corresponding Column, Column Type, Output Field Type, and Output Field display for each column you select in the Column field.
Use the following fields:
Field
Description/Action
Column
The column name in table or stream.
Column Type
The column data type defined in table or stream.
Output Field Type
The data type of the output field. Adapter for Apache Kafka automatically converts table or stream-specific types to Java data types.
Output Field
The name of the field containing the output from the SELECT operation. An output field name displays when you select an expression. You can also modify the output field names as required.
PARTITION BY
The column acts as the key column for the stream, if PARTITION BY clause is present.
10. Use the WHERE tab to specify the conditions for selecting information:
a. Select the icon to define new WHERE clause fields.
b. Select a logical operator from the AND/OR field, an Operator, and separators (the left and right parentheses) as needed, and specify values for the following fields:
Field
Description/Action
AND/OR
The logical operator.
Column
The name of the column you want to use in the WHERE clause.
Operator
The operator used with the Column and Input Field.
Input Field
The default value is ?, which acts as a placeholder for the variable so that you can set the input variable for that column at run time, or get input external to this adapter service. You can also type a fixed value in this field now or at run time. If you type a fixed value, be sure that it is valid, or an exception will be generated at run time.
The adapter automatically generates values for the following fields:
Field
Description
Parameter
The number of conditions present in WHERE clause.
Column (second occurrence of this field)
The name of the column you want to use in the WHERE clause.
Input Field Type
The corresponding input field's Java type.
Input Field (second occurrence of this field)
The name of the input field. By default the name combines the values of the Parameter and Column fields. However, you can also specify a custom value.
c. If necessary, use the or icons to change the order of the WHERE clause to ensure the parameters are parsed in the correct order.
d. Repeat this procedure until you have specified all WHERE parameters.
11. From the File menu, select Save.