Contents
The TIBCO® LiveView Create Drop table output adapter allows a StreamBase application to create, start, and drop LiveView tables dynamically on running LiveView servers.
This section describes the properties you can set for this adapter, using the various tabs of the Properties view for the adapter's icon in StreamBase Studio.
Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.
Adapter Name: A read-only field that shows the formal name of the adapter.
Class: A field that shows the fully qualified class name that implements the functionality of this adapter. Use this class name when loading the adapter in StreamSQL programs with the APPLY JAVA statement. You can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.
Start with application: If this field is set to Yes or a module parameter that evaluates to true, an instance of this adapter starts as part of the containing StreamBase Server. If this field is set to No or a module parameter that evaluates to false, the adapter is loaded with the server, but does not start until you send an sbadmin resume command, or start the component with StreamBase Manager. With this option No or false, the adapter does not start even if the application as a whole is suspended and later resumed. The recommended setting is selected by default.
Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.
Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.
This section describes the properties on the Adapter Properties tab in the Properties view for the LiveView Query adapter.
Property | Description |
---|---|
Set Server URI to encapsulating LiveView |
Select this check box when the adapter is part of a LiveView project. In
this case, the adapter connects to the port of the running LiveView server.
When authentication is enabled, the credentials used to connect to the
LiveView server are retrieved from the liveview.internal.username and liveview.internal.password system properties. The
corresponding LiveView user must be configured with the appropriate
permissions to allow this adapter to perform its operations.
|
LiveView Server URI |
A LiveView server URI, or an expression or variable that resolves to a
LiveView server URI. For example, the URI for the local machine and default
port is lv://localhost:10080 .
|
Share LiveView Connection | When selected (the default), this instance of the adapter shares a single LiveView connection to the configured LiveView server with all other LiveView adapters in the same container that also have the Share LiveView Connection property selected. The LiveView adapters that can share connections are Query, Publish, Delete, Ready, and Create Drop table. |
Connect Inline | When selected, if the adapter does not currently have a LiveView connection to the configured server, it will attempt to connect immediately. This will block the application or concurrent region until the connection attempt succeeds or times out. Note that if the adapter is not currently connected there is a background thread that is periodically attempting reconnects. Thus, Connect Inline is only operable for a small timing window between when the background thread makes the LiveView connection and if a tuple arrives just before the background thread attempts the reconnection. |
Log Level | Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL. |
Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.
Caution
Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.
The LiveView Create Drop Table adapter provides one input port, and two output ports:
-
The input port is used to send Create, Start, CreateStart, or Drop commands to the adapter.
-
The Status output port emits tuples that provide information about each table command, and the status of the connection to the configured LiveView server.
-
The other output port is a passthrough output of the input tuple.
As with other StreamBase adapters, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.
The input port is used to send Create, Start, CreateStart, or Drop commands to the adapter. Refer to the LiveView dynamic table documentation for more information about state transitions when creating, starting, and dropping tables.
The input port's schema is shown in the following table. When sending a tuple to unregister an existing query, use only the first and last fields.
Field | Data Type | Description | ||||
---|---|---|---|---|---|---|
Command | string |
The table command to execute which must be one of the following strings:
|
||||
TableName | string | The name of the table to operate on. This field must be set for all commands. | ||||
Indices | list<list<string>> | Defines the indexes for the table for use with the Create command. The inner list is a comma-separated list of field names that comprise a single index. The first list<string> in the outer list is the primary key for the table, while subsequent list<string> are secondary indexes. | ||||
Description | string | An optional text string for the Create command which is to be included in the Description field of the LiveView server's LVTables system table. | ||||
Schema | string |
This string defines the schema of the table to be used with the
Create command. The string
format is the StreamBase StreamSQL schema format. For example
(x int, s string)
represents a table with two fields, the first of which is x of type int and the second of which is s of type string.
|
||||
WaitTime | int | The number of milliseconds to wait before declaring a timeout when Creating, Starting, or Dropping a table. If null, the default is 180,000 ms. This default can be changed by setting the system property streambase.adapter.lvcreatedrop.waitMS. | ||||
AggregationQuery | boolean |
If non-null, the table being created is an aggregate table and this field
should have a fully specified LiveQL select statement that uses aggregate
functions. For example select count() as
MyCount, s from MyBaseTable group by s . This
AggregationQuery says to use MyBaseTable as the base table and the
aggregate function is a count of the number of rows in the group
s .
|
||||
Synchronous | boolean | If true, do not emit the output passhrough tuple until the command completes, whether successfully or in failure. If null or false, emit the passthrough tuple immediately. In any case, the success or failure of a command is reported on the status port. |
The LiveView Create Drop Table adapter has one output status port and one through tuple output port.
The status port has the fields shown in the following table:
Field | Data Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
Type | string |
The basic state reported, always one of the following:
|
||||||
Object | string | The name on the EventFlow canvas of the adapter reporting the status. | ||||||
Action | string |
The action that occurred, one of the following:
|
||||||
Message | string |
A human-readable string that provides additional context for the status
message. TABLE_* actions always start with Table:
MyTableName.
|
||||||
Time | timestamp | The time the action occurred. |
The LiveView Create Drop Table adapter has an output port that that uses the schema of the input port and passes on the input tuple either immediately if not Synchronous, or delayed until the command action is completed if Synchronous — whether the command completes succesfully or in failure. In all cases, the success or failure of the command is determined by looking at the status output port.
Add an instance of the adapter to a new EventFlow application with the following steps:
-
In StreamBase Studio, create a project, including an empty StreamBase EventFlow application file to host the adapter.
-
From the Operators and Adapters drawer of the Palette view, drag the Adapters, Java Operators icon to the canvas. This opens the Insert an Operator or Adapter dialog.
-
In the search field, type a string such as
liveview
to narrow the list of adapters. Select the icon for the LiveView Create Drop Table adapter, then click . -
Double-click the adapter's icon and select the Adapter Properties tab in the Properties view.
-
Next, either:
-
If this adapter is part of an EventFlow module that is itself part of a LiveView project, select the Set Server URI to encapsulating LiveView check box. This check box tells the adapter to connect to the host and port for the current project's LiveView server.
-
Or specify the URI for a local or remote LiveView server to connect to (or accept the default URI,
lv:/localhost:10080
).
-
-
Specify the other options in the Adapter Properties tab as required.
-
Specify a schema for the input port, as described in LiveView Create Drop Table Adapter Input Port.
-
Add two Output Streams and connect arcs to them from the LiveView Create Drop Table adapter's output ports.
-
At runtime, this LiveView Create Drop Table adapter connects to the specified LiveView server and is then ready to accept commands.
The LiveView Create Drop Table adapter uses typecheck messages to help you configure the adapter.
The adapter generates warning messages at runtime under various conditions, including:
-
The configured LiveView server is not available.