LiveView Delete Output Adapter

Introduction

The Spotfire 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 name of this instance of this component. The name must be unique within the current EventFlow module. The name can contain alphanumeric characters, underscores, and escaped special characters. Special characters can be escaped as described in Identifier Naming Rules. 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 options: This field provides a link to the Cluster Aware tab, where you configure the conditions under which this adapter starts.

Enable Error Output Port: Select this checkbox 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 purpose and function of the component. In the EventFlow Editor 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 checkbox 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:11080.
Use Runtime URIs Enables an additional input port to this adapter. The input port expects tuples of the schema (ControlAction: string, URI: string). The author time URI options are greyed out and the adapter will wait to connect until it receives a Connect tuple. If the connection fails, the adapters will continue to try and connect. If the adapter receives a Disconnect tuple, it will disconnect from its current connection, if it has one, or stop trying to connect if it’s currently in failure.
Connection Key Only enabled if Use Runtime URIs and Share LiveView Connection are enabled. If both are enabled, this is a required property which defines groups of adapters that will share connections. An author-defined string of alphanumeric characters is expected here like Pool1 or Pool2. All adapters set to share connections and use runtime URIs with the Connection Key Pool1 will connect and disconnect using a single shared connection as Connect/Disconnect tuples are received by any one of the adapters in the group.
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.
Enable Compressed Connection If checked, compress this adapter's LiveView connection. Not enabled if Use Runtime URI is also selected. To compress a connection defined at runtime, see the "ConnectCompress" control action defined in the Runtime URI Schema
Connect Inline

When this checkbox is cleared (the default state), tuples are sent to the target table after every Publisher Flush Interval. A background reconnection thread in the adapter continuously tries to reconnect to the specified server so that a connection is available when tuples need to be sent. However, a window can occur during which the server is actually up, but the adapter is disconnected, and the reconnection thread is waiting for its next connection attempt. This situation can cause a delay in having the freshest tuple information written to the LiveView table.

To avoid this situation, select this checkbox. In this case, if the adapter is currently disconnected from the server, it attempts to reconnect inline each time a tuple or batch of tuples is ready to be sent to the target table. Use this feature carefully, because, while it can speed up the freshness of live data on the server, it can also cause long application delays while each connection is attempted.

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.

Cluster Aware Tab

Use the settings in this tab to enable this operator or adapter for runtime start and stop conditions in a multi-node cluster. During initial development of the fragment that contains this operator or adapter, and for maximum compatibility with releases before 10.5.0, leave the Cluster start policy control in its default setting, Start with module.

Cluster awareness is an advanced topic that requires an understanding of StreamBase Runtime architecture features, including clusters, quorums, availability zones, and partitions. See Cluster Awareness Tab Settings on the Using Cluster Awareness page for instructions on configuring this tab.

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 Spotfire Streaming adapters, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.

An optional Use Runtime URI Input Port is also available for Connecting/Disconnecting to LiveView servers at runtime instead of at author time.

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.

The adapter can import a proposed schema for the input port that you can use as a starting point.

To import an input schema, click the Import proposed schemas hyperlink in the top right corner above the Adapter Properties tab. From the dialog, click Browse to select an existing destination interface file, or click New File to save a Named schema file to a project folder.

Runtime URI Input Port

When Use Runtime URIs is enabled on this adapter, so is this port.

This port accepts tuples of the below schema.

Field Data Type Description
ControlAction string A value of either
Connect ConnectCompress Disconnect
If Connect or ConnectCompress, the adapter (and any adapters with whom it shares a connection) will connect to the LiveView server specified in the URI field. If currently connected (or attempting to connect) to a URL, that will be closed and the new URL attempted. If Disconnect, this adapter or adapter group will disconnect from its currently connected LiveView server. ConnectCompress will initiate a compressed connection, and Connect will initiate an uncompressed connection.
URI string The URI of a LiveView server such as lv://localhost:11080. The adapter will attempt to connect to the LiveView server at this address if Connect or ConnectCompress is supplied in this tuple's ControlAction. If Disconnect is supplied as the ControlAction, a value for URI need not be supplied and will be ignored.

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:11080).

  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.