LiveView Delete Output Adapter

Introduction

The TIBCO LiveView® Delete adapter allows a StreamBase application to delete one or more rows in a LiveView table based on a specified predicate.

The adapter requires an input connection on its input port, having a specific schema described below. This can be an input stream for interactive use by a human operator, or can be the output of some other element in an EventFlow application. When a correctly formatted tuple is received on the input port, a request is sent to the LiveView server named in the adapter's properties. This request specifies the deletion of the rows in the table named in the input tuple that match the predicate, also specified in the input tuple.

Properties

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.

General Tab

Name: Use this required field to specify or change the component's name, which must be unique in the current module. 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: A read-only field that shows the formal name of the adapter.

Class name: Shows the fully qualified class name that implements the functionality of this adapter. If you need to reference this class name elsewhere in your application, 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 (default) or to a module parameter that evaluates to true, this instance of this adapter starts as part of the JVM engine that runs this EventFlow fragment. If this field is set to No or to a module parameter that evaluates to false, the adapter instance is loaded with the engine, but does not start until you send an epadmin container resume command (or its sbadmin equivalent), or until you start the component with StreamBase Manager.

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 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.

Adapter Properties Tab

This section describes the properties on the Adapter Properties tab in the Properties view for the LiveView Delete 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.
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.

Concurrency Tab

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.

Adapter Ports

The LiveView Delete adapter has an input port whose schema supplies the name of the LiveVie table from which to delete, and supplies the predicate that will select the rows to delete. A status output port is provided that supplies information about connection status and the success or failure of delete requests.

As with other StreamBase adapters, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.

LiveView Delete Adapter Input Port

You must supply values for the TableName and Predicate fields for the input port. The QueryID field is optional.

Field Data Type Description
TableName string The name of the LiveView target table.
Predicate string The predicate used to select the rows to delete. This can be any StreamBase expression that resolves to a LiveView query predicate. The simplest predicates are of the form TableColumn="value-with-matching-rows-to-delete". For example, category="book".
QueryID string Optional. If the QueryID field is present, the value of this field appears in the Message field of tuples emitted on the Status output port. If this field is not present in the input port's schema, the value of the Predicate field is shown in such tuples. Use this field to annotate or enumerate your delete requests.

LiveView Delete Adapter Output Ports

The LiveView Delete adapter has one output status port. For each delete request sent as an input tuple on the adapter's input port, one or more tuples are emitted on the status port:

  • One CONNECTION message to show the success or failure of the connection to the LiveView server.

  • For successful delete requests:

    • One QUERY message with Action type DELETE_BEGIN.

    • One QUERY message with Action type DELETE_END.

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 values:
CONNECTION QUERY
ERROR  
Object string The name on the EventFlow canvas of the adapter reporting the status.
Action string The action that occurred, one of the following:
CONNECTED DELETE_BEGIN
FAILED DELETE_END
ERROR  
Message string A human-readable string that provides additional context for the status message. This field's value is supplied from Predicate or QueryID field of the tuple on the input port, as described above for the QueryID field.
Time timestamp The time the delete action occurred.

Using the Adapter in a StreamBase Application

Add an instance of the adapter to a new EventFlow application with the following steps:

  1. In StreamBase Studio, create a project, including an empty StreamBase EventFlow application file to host the adapter.

  2. 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.

  3. In the search field, type a string such as liveview to narrow the list of adapters. Select the icon for the LiveView Delete adapter, then click OK.

  4. Double-click the adapter's icon and select the Adapter Properties tab in the Properties view.

  5. Next, either:

    1. 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.

    2. Or specify the URI for a local or remote LiveView server to connect to (or accept the default URI, lv:/localhost:10080).

  6. Add an Input Stream and connect an arc from it to the LiveView Delete adapter's input port.

  7. Specify a schema for the input port that uses either two or three fields, as described in LiveView Delete Adapter Input Port.

  8. Add an Output Stream and connect an arc to it from the LiveView Delete adapter's output port.

  9. At runtime, send a tuple to this module's input port, specifying the name of the LiveView table from which to delete rows, and the predicate portion of a LiveView query that matches one or more rows in that table.

Typechecking and Error Handling

The LiveView Delete 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.

Suspend and Resume Behavior

When suspended, the adapter stays connected to the LiveView server; therefore, on resume the adapter is still connected. The adapter is not used unless a correctly formed tuple is received on its input port.