- Index

< Previous |  | Next >

# APPLY Statement

## Syntax

### Modules

    APPLY [PARALLEL [number_of_instances BY field_identifier]]
        MODULE {"file_name.ssql" | "file_name.sbapp"}
        ['('parameter_list')']
      FROM input_stream_identifier_1=stream_identifier_input_1[, ...]
           [, module_query_table_1=query_table_1[, ...]]
      INTO output_stream_identifier_1=stream_identifier_output_1[, ...]
      [ERROR INTO stream_identifier];

Or

    APPLY [PARALLEL [number_of_instances BY field_identifier]]
        MODULE {"file_name.ssql" | "file_name.sbapp"}
        ['('parameter_list')']
      FROM input_stream_identifier_1=stream_identifier_input_1[, ...]
      INTO output_stream_identifier_1=stream_identifier_output_1[, ...]
           [, module_query_table_1=query_table_1[, ...]]
      [ERROR INTO stream_identifier];

These two formats are identical with the exception of the placement of the `inner_module_query_table=outer_module_query_table` assignments, which are optionally in either the FROM or INTO clause.

### Java Operator

    APPLY [PARALLEL] JAVA "java_class_name" ['('parameter_list')']
      [AS operator-name]
      FROM input_stream_identifier_1[, ...]
      INTO output_stream_identifier_1[, ...]
      [ERROR INTO stream_identifier];

### Java Embedded Adapter

    APPLY [PARALLEL] JAVA "java_class_name" '('parameter_list')'
      [AS adapter-name]
      FROM stream_identifier | INTO stream_identifier
      [ERROR INTO stream_identifier];

### JDBC Table

    APPLY [PARALLEL] JDBC jdbc_datasource_name "sql_statement"
      [(result_set_schema)]
      FROM input_stream_identifier
      INTO output_stream_identifier
      [ERROR INTO stream_identifier];

### Substitutable Fields

`number_of_instances`

  The number of parallel instances of the module to instantiate.

`field_identifier`

  An integer type tuple field in an input stream to the module that is used to distribute incoming tuples across multiple instances of the module. Each distinct value of `field_identifier` is guaranteed to be delivered to the same instance of the module.

`file_name.ssql`, file_name.sbapp

  The StreamSQL or EventFlow file that includes the definition of the application to be used as a module. This file name must be enclosed within double quotation marks.

`java_class_name`

  The full package and class name of the Java class that implements either the operator or embedded adapter functionality. The class name must be enclosed within double quotation marks.

`parameter_list`

  Entries of the format `parameter_name`=`value`. Multiple entries in the list are separated by commas. For Java embedded adapters, entries can include schemas.

  `parameter_name`

    The name of a parameter being passed to a parameterized module, Java operator, or embedded Java adapter.

  `value`

    The value of the corresponding parameter in a parameter_list.

    When passing parameters to a parameterized module, `value` must always be enclosed in quotation marks ("`value`") regardless of its type; if `value` is a string type, then it must also be enclosed within escaped quotation marks ("\"`value`\""). When passing parameters to a Java operator or Java embedded adapter, only string parameter types must be enclosed within unescaped quotation marks (for example, "`value`" where `value` is a string type).

`jdbc_datasource_name`

  The value of the name attribute in a `<data-source>` entry within the `sbd.sbconf` configuration file used by this StreamSQL application. It is through this link that the database connection details are obtained by the application. The `sbd.sbconf` file is described in the StreamBase Server Configuration File XML Reference topic.

`result_set_schema`

  A subset of one or more of the schema fields returned from the JDBC table query selection. Only the subset is included in the output stream. All unspecified fields are ignored. Specify the result set schema as a comma-separated list in this format:

      field_name data-type [size][, field_name data-type [size]...]

  For example:

  `foo int, bar string 10`

  Without the optional result set schema, the entire result set is returned.

`stream_identifier`

  The unique identifier (name) of a named stream within the application. When used within the `INTO` clause, the named stream receives tuples from an embedded adapter; when used within the `FROM` clause, the named stream provides tuples to an embedded adapter.

`input_stream_identifier`: `input_stream_identifier_n`

  The unique identifier (name) of an input stream in a module or custom Java operator. There can be multiple input streams in a module or custom Java operator.

`output_stream_identifier`: `output_stream_identifier_n`

  The unique identifier (name) of an output stream in a module or custom Java operator. There can be multiple output streams in a module or custom Java operator.

`stream_identifier_input_n`

  The unique identifier (name) of a stream in the main application that submits tuples to an input stream of a module or Java operator.

`stream_identifier_output_n`

  The unique identifier (name) of a stream in the main application that receives tuples emitted by an output stream in a module or Java operator.

`module_query_table` `module_query_table_n`

  The unique identifier (name) of a query table in an EventFlow or StreamSQL module. When included in the `FROM` clause of the APPLY statement, the `module_query_table`=`query_table` assignment indicates that the module accesses a shared query table in another application or module. When included in the `INTO` clause of the `APPLY` statement, the `module_query_table`=`query_table` assignment indicates that the module's table is shared with other modules; the identifier `query_table` is declared in a `CREATE TABLE `query_table`` statement.

`query_table` `query_table_n`

  The unique identifier (name) of a query table in a StreamSQL application or module. When included in the `FROM` clause of the `APPLY` statement, the `module_query_table`=`query_table` assignment indicates that the module accesses a shared query table in another application or module. When included in the `INTO` clause of the `APPLY` statement, the `module_query_table`=`query_table` assignment indicates that the module's table is shared with other modules; the identifier `query_table` is declared in a `CREATE TABLE `query_table`` statement.

... in the FROM clause of the APPLY MODULE statement

  Additional module input stream to application input stream mappings of the form `input_stream_identifier_n=stream_identifier_input_n` or inner module query table to outer module query table mappings of the form `inner_module_query_table_n=outer_module_query_table_n`.

... in the INTO clause of the APPLY MODULE statement

  Additional module output stream to output stream mappings of the form `output_stream_identifier_n=stream_identifier_output_n` or inner module query table to outer module query table mappings of the form `inner_module_query_table_n=outer_module_query_table_n`.

... in the FROM clause of the APPLY JAVA operator statement

  Additional input streams to the custom Java operator of the form `input_stream_identifier_n`.

... in the INTO clause of the APPLY JAVA operator statement

  Additional output streams from the custom Java operator of the form `output_stream_identifier_n`.

`operator-name`, `adapter-name`

  An optional name for a Java operator or Java embedded adapter. If a Java operator or adapter is named, you can use the sbadmin command to suspend, resume, or shut down the specified operator or adapter, independent of any other applications and containers running at the same time.

### ERROR INTO Clause

For all forms of APPLY, you can append an ERROR INTO clause just before the closing semicolon. The StreamSQL ERROR INTO clause is analogous to the Enable Error Output Port check box for operators and adapters in EventFlow applications.

Use ERROR INTO with the name of a stream, which must already exist. This sets up an Error Port for the operator or module, which is much like a local catch mechanism for errors from that operator or module.

See Using Error Ports and Error Streams for a discussion of StreamBase error handling mechanisms.

## Discussion

Use the `APPLY` statement to include an existing EventFlow or StreamSQL module, a Java operator, or an embedded adapter into a StreamSQL application. It can also be used to query tables in an external JDBC database. The optional keyword `PARALLEL` causes the statement to run in a thread separate from the thread running the main application.

### Modules

To use a StreamSQL or EventFlow application as a module within another StreamSQL application, use the `APPLY` statement. Since the module application can have multiple input and output streams, you must specify a mapping between the streams in the StreamSQL application corresponding to each of the module's streams.

The name of the file that identifies the module must be within quotation marks. The `input_stream_identifier=stream_identifier_input` entries following the `FROM` keyword map each of the module's input streams to streams in the referencing StreamSQL application or module. The `output_stream_identifier=stream_identifier_output` entries following the `INTO` keyword map each of the module's output streams to streams in the referencing StreamSQL application or module. If the module only has one input or output stream, list the name of the corresponding stream in the referencing StreamSQL application or module. That is:

    stream_identifier_input

Rather than:

    module_input_stream_identifier=stream_identifier_input

When a referencing StreamSQL application or module implements a shared query table that an inner module accesses, include the `inner_module_query_table`=`outer_module_query_table` assignment(s) in the `FROM` clause. When a referencing StreamSQL application or module accesses a shared query table implemented in an inner module, include the `inner_module_query_table`=`outer_module_query_table` assignments in the `INTO` clause; the identifier `outer_module_query_table` is declared in a `CREATE TABLE `outer_module_query_table`` statement within the outer StreamSQL application or module.

The optional `number_of_instances BY field_identifier` clause can only be used if the optional `PARALLEL` is specified. The use of this clause allows multiple instances of the module to be instantiated. The type of `field_identifier` must be an integer or be converted to an integer. If the type of `field_identifier` is a string, use the `hash(field_identifier)` function to generate an integer from the value of the string. Tuples with the same `field_identifier` value are guaranteed to be processed by the same module instance. Use of the `PARALLEL` keyword without the optional clause creates only a single instance of the module, which processes all incoming tuples.

The optional `parameter_list` clause, used to pass parameter values to the module, consists of one or more `parameter_name`=`value` entries, separated by commas. When passing parameters to a parameterized module, `value` must always be enclosed in quotation marks ("`value`") regardless of its type; if `value` is a string type, then it must also be enclosed within escaped quotation marks ("\"`value`\""). Modules that utilize parameters have default values for the parameters set at design time. The `parameter_list` entries are only required for parameters that need to be reset to a different value at run time.

### Java Operators

To use a Java operator within a StreamSQL application, provide, in quotation marks, the full package and class name of the implementation class, and enclose in parentheses the parameters used by this class. These are the same parameters that are set on the Parameters tab of the EventFlow Java operator. The source of tuples submitted to the Java operator is the stream referenced in the `FROM` clause, and the tuples emitted by the operator are written to the stream referenced in the `INTO` clause.

### JDBC Tables

The `APPLY JDBC` statement allows you to run SQL queries from within your StreamSQL application against tables in an external database.

The first argument of the statement references the name of an external data source. As soon as the statement is entered, StreamBase Studio connects to the data source. If the connection fails (for example, an "unknown data-source" message is displayed), the StreamSQL Editor cannot typecheck the application. Therefore, a `<data-source>` must be configured within the project's `sbd.sbconf` configuration file before the `APPLY JDBC` statement can be coded. See examples for data-source configurations in <data-sources> Examples and <data-source> Examples.

In the following StreamSQL code, the application references the `myDB` data source configured above, then queries a table, and finally sends the result to the application's output stream:

    CREATE INPUT STREAM in (symbol string, price double, SKU int);
    CREATE OUTPUT STREAM out;

    APPLY JDBC myDB "SELECT * (symbol string, id int)
        FROM table WHERE column_name={symbol}" FROM in INTO out;

Within the SQL statement, string literals are demarcated by single quotation marks. Since braces (`{` and `}`) are used to demarcate parameters, braces used within the SQL statement must be escaped with the backslash (`\`) character.

As the preceding example shows, `APPLY JDBC` statements process data from both the external database and an input stream in the application:

- The `APPLY JDBC` statement always passes through all of the input stream's fields. This is different from the Query operator in an EventFlow application, where input schema fields can be optionally suppressed by choosing the explicitly specified fields option in the Pass Input tab. To suppress one or more input stream fields in the output, consider either adding a `SELECT` statement `after` the `APPLY JDBC` statement, or writing an EventFlow application instead of a StreamSQL application.

  The following example shows a `SELECT` statement that removes fields from the output of the preceding the `APPLY JDBC` statement:

      SELECT SYMBOL, PRICE FROM out => CREATE OUTPUT STREAM subsetout;

  In this example, the `subsetout` stream contains only the `SYMBOL` and `PRICE` fields from the output of the preceding APPLY JDBC statement.

- The SQL statement that will be run against the database is enclosed in double quotation marks. Note that operations on the data source are performed using SQL instead of StreamSQL statements. The syntax of the SQL statement depends on the type of database in use, and is documented by your database vendor.

- By default for JDBC databases, all of the result set from the SQL operation is written to the output stream referenced in the `INTO` clause. You can filter the result set from the database by specifying the explicit schema of fields to be included.

- Within the SQL statement, values in the stream are accessed by enclosing them in `{` and `}` braces. In the example, the `WHERE` clause matches the value of `{symbol}` fields in the stream against `column_name` column in the database table.

- The `FROM` clause specifies an application stream that is used in coding the query.

### Note

One difference between using JDBC data sources in EventFlow and StreamSQL modules is that the APPLY JDBC statement always passes through all of the input stream's fields. To suppress one or more fields in the output, you can add a SELECT statement after the APPLY JDBC statement. By contrast, in an EventFlow module, the Query operator allows you to explicitly choose the input stream fields to include in the output.

### Java Embedded Adapters

To use a Java embedded adapter in a StreamSQL application, provide, in quotation marks, the full package and class name of the implementation class, and enclose in parentheses the parameters used by this class. These are the same parameters that are set on the Adapter Settings tab of the EventFlow embedded adapter. Parameter values that are strings must be enclosed in double quotation marks. Parameter values are not positionally defined and can be entered in any sequence.

For Java embedded adapters, you can pass a schema in your `parameter_list`. (This feature is available only in StreamSQL, not in EventFlow applications). The schema is specified as a parenthesized, comma-separated list of field names and types in the tuple produced by the adapter, in the following form:

    schema-name=(field-name type[,field-name type...])

The sequence of types must be the same as the data in the input file.

For example, this statement from the CSV Reader adapter includes a schema:

    APPLY JAVA "com.streambase.sb.adapter.csvreader.CSVReader"
      (FileName="example.csv", Delimiter=",", QuoteChar="\"",
      TimestampFormat="MM/dd/yyyy hh:mm:ss aa", Period=0, Repeat=1,
      Schema=(Timestamp timestamp, Username string, IP string))
      INTO OutputStream1;

If the adapter reads data from an external input adapter, then an `INTO` clause identifies the named stream that will receive tuples from the adapter. If the adapter writes data to an external output adapter, then a `FROM` clause identifies the named stream from which the adapter receives tuples.

#### CSV File Reader Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.csvreader.CSVReader`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.csvreader.CSVReader class

Parameter | Description
--- | ---
FileName | The name of the file from which data will be read one line at a time. This file must be located either in the same directory in which the StreamBase Server is started or in a directory identified in a `<operator-resource-search directory>` element within the `<global>` section of the configuration file used by the StreamBase Server running the application. This parameter is required.
Delimiter | The character used to separate values in the data file. This parameter is optional and defaults to a comma; if desired, enter a string value (for example, `","`) to explicitly specify the parameter's value.
QuoteChar | The character used within the file to delimit string values. This character is optional and defaults to a double quotation mark; if desired, enter a string (for example, `"\""`; note how the \ is used to escape the " that represents the desired QuoteChar) to explicitly specify the parameter's value.
TimestampFormat | The string format used to represent timestamp values. This parameter is optional and defaults to "MM/dd/yyyy hh:mm:ss aa".
Period | The time to wait, in milliseconds, between the processing of records. This parameter is optional.
Repeat | The number of times to iterate over the csv file; the value 0 means iterate indefinitely. This parameter is optional.
Schema | A list of field names and types in the tuple produced by the adapter. See Java Embedded Adapters for details and an example.

#### CSV Socket Reader Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.csvreader.CSVSocketReader`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.csvreader.CSVSocketReader class

Parameter | Description
--- | ---
Hostname | A string containing either the host name or IP address of the computer sending data.
Port | An integer used to specify the TCP port to use to receive input.
Delimiter | The character used to separate values in the data file. This parameter is optional and defaults to a comma; if desired, enter a string value (for example, `","`) to explicitly specify the parameter's value.
QuoteChar | The character used within the file to delimit string values. This character is optional and defaults to a double quotation mark; if desired, enter a string (for example, `"\""`; note how the \ is used to escape the " that represents the desired QuoteChar) to explicitly specify the parameter's value.
TimestampFormat | The string format used to represent timestamp values. This parameter is optional and defaults to MM/dd/yyyy hh:mm:ss aa".

#### JMS Reader Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.jms.enqueue.JMSReader`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.jms.enqueue.JMSReader class

Parameter | Description
--- | ---
ConfigFile | The name of the configuration file used by the adapter. This file must be located either in the same directory in which the StreamBase Server is started or in a directory identified in a `<operator-resource-search directory>` element within the `<global>` section of the configuration file used by the StreamBase Server running the application. This parameter is required.
Schema | A list of field names and types in the tuple produced by the adapter. See Java Embedded Adapters for details and an example.

#### Regular Expression Reader Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.regexreader.RegexReader`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.regexreader.RegexReader class

Parameter | Description
--- | ---
`FileName (resource)` | The file to read and parse. This file is read one line at a time. Each line is parsed using the `Format` property and emits one tuple. This file must be located either in the same directory in which the StreamBase Server is started or in a directory identified in a `<operator-resource-search directory>` element within the `<global>` section of the configuration file used by the StreamBase Server running the application. This parameter is required.
`Format` | The regular expression used the parse the input file. This must be a Java regular expression as expected by the java.util.regex.Pattern class. For example, `"([^,]*),([^,]*)"` could be used to parse a simple, two field CSV file. This parameter is required.
`Period` | The rate, in milliseconds, at which to read lines from File and emit tuples. Specify 0 or omit this property to emit tuples as quickly as possible. This parameter is optional.
`Repeat` | The number of times to repeat the input file. If omitted or 1, this reads the input file once and then stops emitting tuples. If set to 0, the repeats the input file indefinitely. This parameter is optional.
`DropMismatches` | If true, records that do not match the Format regular expression are ignored and the next record immediately examined. Otherwise, a tuple with all fields set to null is emitted when a non-matching input line is encountered. Acceptable values are `true` or `false`.
`TimestampFormat` | The format, expressed as a string, used to parse timestamp fields extracted from the input file. The format of the format string is described in the `java.text.SimpleDateFormat` class described in the Oracle Java Platform SE reference documentation.
`Schema` | A list of field names and types in the tuple produced by the adapter. See Java Embedded Adapters for details and an example.

#### Regular Expression Socket Reader Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.regexreader.RegexSocketReader`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.regexreader.RegexSocketReader class

Parameter | Description
--- | ---
`Format` | The regular expression used the parse the input file. This must be a Java regular expression as expected by the java.util.regex.Pattern class. For example, `"([^,]*),([^,]*)"` could be used to parse simple, two field CSV input. This parameter is required.
`DropMismatches` | If `true`, records that do not match the `Format` regular expression are ignored and the next record immediately examined. If `false`, a tuple with all fields set to null is emitted when a non-matching input line is encountered. This parameter is optional and defaults to `true`.
`TimestampFormat` | The format, expressed as a string, used to parse timestamp fields extracted from the input file. The format of the format string is described in the `java.text.SimpleDateFormat` class described in the Oracle Java Platform SE reference documentation.
`Schema (schema)` | A list of field names and types in the tuple produced by the adapter. See Java Embedded Adapters for details and an example.
`Hostname` | A string containing either the host name or IP address of the computer sending data.
`Port` | An integer used to specify the TCP port to use to receive input.

#### OpenTick Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.opentick.OpenTick`. The `parameter_list` includes the following parameter:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.opentick.OpenTick class

Parameter | Description | Acceptable Values
--- | --- | ---
`ConfigFile` | The name of the XML based configuration file for the adapter instance. For details on writing this configuration file, refer to the discussion of the OpenTick adapter in the Adapters Guide included in the StreamBase documentation set. This parameter is required. | `ConfigFile= "opentick-config.xml"`

#### StreamBase to StreamBase Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.sbd2sbdinput.SBD2SBDInput`. The `parameter_list` includes the following parameters:

Parameters and description of each for the com.streambase.sb.adapter.sbd2sbdinput.SBD2SBDInput class

Parameter | Description
--- | ---
`UpstreamHost` | A string containing the host name or IP address of the upstream application.
`UpstreamPort` | A string containing the TCP port number of the upstream application.
`UpstreamStream` | A string containing the name of the stream to read from in the upstream application. If no stream with this name is present in the upstream application, or the stream's schema is incompatible with the schema configured in the adapter, the downstream application behaves as though the upstream application is inaccessible. The `Reconnect Interval` property determines whether the downstream application attempts to reconnect periodically until a compatible stream is present.
`ReconnectInterval` | An integer representing the period, in seconds, the downstream application waits in between reconnect attempts after the upstream application fails or no compatible stream is present. Set this property to zero to disable reconnection. When reconnection is disabled, the upstream application must be started first and must have a compatible output stream from which the downstream application can read.
`Schema` | The schema to output into the downstream application. This schema must match that of the output stream in the upstream application.

#### CSV File Writer Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.csvwriter.CSVWriter`. The `parameter_list` includes the following parameters:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.csvwriter.CSVWriter class

Parameter | Description | Acceptable Values
--- | --- | ---
FileName | Path and name of file into which the adapter will write data. If this adapter is configured with a maximum file size, then this filename is appended with the date and time if the maximum file size is reached. When running Windows, the backslash path separator character must be escaped (for example, `C:\\myDirectory\\myFile.csv`). As an alternative, use forward slashes with Windows (`C:/myDirectory/myFile.csv`) and UNIX/Linux. | `"path/file_name.extension"`
IncludeHeaderInFile | Include an optional row a the top of each file with the name of each column. | `true` or `false`
IfFileDoesntExist | Action to take if the specified CSV file does not exist when the adapter is started. | `"Fail"` or `"Create new file"`
IfFileExists | Action to take if the specified CSV file already exists when the adapter is started. | `"Truncate existing file"`, `"Fail"`, or `"Append to existing file"`
FieldDelimiter | Character used to mark the end of one field and the beginning of another. | Comma: `","`
StringQuoteCharacter | Character to use to quote strings when they contain the field delimiter. | Double quotation mark: `""\""`
FlushInterval | How often to force tuples to disk. Defined in seconds. | Integer values
NullValueRepresentation | String to write when a field is null. | `"null"`
ThrottleErrorMessages | Only show a given error message once. | `true` or `false`
MaxFileSize | Maximum size, in bytes, of the file on disk. If the file reaches this limit, it is renamed with the current timestamp and new data is put to the current FileName. | Integer values; the value `0` indicates no rolling file
StringQuoteOption | Determines when string fields are quoted in the CSV file. | `"Never quote"`, `"Always quote"`, or `"Quote if necessary"`

#### E-mail Sender Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.emailsender.EmailSender`. Two parameters are needed to configure each adapter setting. The first parameter specifies whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. The second parameter provides either the name of the tuple field that holds the configuration value or a static value for the configuration value. The `parameter_list` includes the following parameters:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.emailsender.EmailSender class

Parameter | Description | Acceptable Values
--- | --- | ---
FromContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
FromValue | Either a string containing the From value or the field name in the tuple from which the From value should be extracted. | Enter, within quotation marks, the From e-mail address or the name of the tuple field that contains this value.
ReplyToContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
ReplyTo | Either a string containing the Reply To value or the field name in the tuple from which the Reply To value should be extracted. | Enter, within quotation marks, the Reply To e-mail address or the name of the tuple field that contains this value.
ToContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
To | Either a string containing the To value or the field name in the tuple from which the To value should be extracted. | Enter, within quotation marks, the To e-mail address or the name of the tuple field that contains this value.
CcContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
Cc | Either a string containing the Cc value or the field name in the tuple from which the Cc value should be extracted. | Enter, within quotation marks, the Cc e-mail address or the name of the tuple field that contains this value.
BccContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Enter the string literal `"Static text"` or the string literal `"Schema field name"`
Bcc | Either a string containing the Bcc value or the field name in the tuple from which the Bcc value should be extracted. | Enter, within quotation marks, the Bcc e-mail address or the name of the tuple field that contains this value.
SubjectContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
Subject | Either a string containing the Subject value or the field name in the tuple from which the Subject value should be extracted. | Enter, within quotation marks, the subject of the e-mail or the name of the tuple field that contains this value.
BodyContains | Whether the configuration value is contained within the tuple being processed or specified in an associated second parameter. | Either the string literal `"Static text"` or the string literal `"Schema field name"`
Body | Either a string containing the From value or the field name in the tuple from which the From value should be extracted. | Enter, within quotation marks, the body of the e-mail message or the name of the tuple field that contains this text.
SmtpPort | The port number on which to contact the SMTP mail server. | Port number
SmtpServer | The URL or IP address of the SMTP mail server. | URL or IP Address
ThrottleErrorMessages | Determines whether the adapter suppresses duplicate error messages. | `true` or `false`

#### XML File Writer Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.xmlfilewriter.XMLFileWriter`. The `parameter_list` includes the following parameters:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.xmlfilewriter.XMLFileWriter class

Parameter | Description | Acceptable Values
--- | --- | ---
`FileName` | Path and name of file into which the adapter will write data. This parameter is required. | `"path/file_name.extension"`
`truncateFile` | If true, truncate file on startup. If false, append to an existing file. This parameter is required. | `true` or `false`.
`maxFileSize` | An integer that sets the maximum XML file size in bytes before closing the file and opening another. This parameter is optional. | `0`, unlimited file size
`bufferSize (optional int)` | An integer that sets the buffer size. This parameter is optional. | `0`, unlimited buffer size
`flushInterval` | An integer that sets how frequently to force flush in milliseconds. This parameter is optional. | `0`, always flush and write immediately
`charset` | A string identifying the character set for the XML file. This parameter is optional; the default is the system property `streambase.tuple-charset`. | `"US-ASCII"`
`escape` | If `true`, XML encode tuple data. The default is `false`. | `true` or `false`

#### XML Over HTTP File Writer Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.xmloverhttp.XMLOverHTTP`. The `parameter_list` includes the following parameters:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.xmloverhttp.XMLOverHTTP class

Parameter | Description | Acceptable Values
--- | --- | ---
`URL (string)` | A string containing the URL to send the HTTP POST request. This parameter is required. | `"URL"`
`flushInterval` | An integer indicating how often to deliver messages to the URL, in milliseconds. If set to 0, messages are delivered immediately. This parameter is optional. See the `maxMessageChache` parameter for the case where this parameter is required. | An integer >= 0.
`maxMessageCache` | An integer that sets the maximum number of messages to queue each interval. If set to 0, unlimited messages are cached per interval. This parameter is optional. If the `maxMessageCache` parameter is set, the `flushInterval` parameter must also be set and its value must be greater than 0. | An integer >= 0.

#### Adobe Flex Embedded Adapter

The Java class that implements this adapter is: `com.streambase.sb.adapter.flexserver.FlexServer`. The `parameter_list` includes the following parameters:

Parameters with description and acceptable values of each for the com.streambase.sb.adapter.flexserver.FlexServer class

Parameter | Description | Acceptable Values
--- | --- | ---
`StreamNames` | A listing of one or more names that represent streams to be served by the adapter to Flex clients. Streams are listed in the order they are connected to the adapter's input ports. As names are added to this listing, additional input ports appear on the adapter icon within StreamBase Studio. Flex clients subscribe to streams using the names entered in this table. | Any named stream. Enclose the name in quotation marks. For example, to specify make tuples on two streams available to a Flex client application, include entries similar to the following. This parameter is required.
    StreamNames.0="namedStream1",
    StreamNames.1="namedStream2"
`ListenPort` | This property provides the TCP port number on which the adapter listens for incoming connections from Flex clients. This parameter is optional. | `ListenPort="20000"`
`PolicyFile` | This property contains the name of a cross-domain policy file used to enforce Flash Player security rules. Flex applications can access all data resources in the same domain as the `.swf` file. However, in retrieving data from a different domain, the policy file determines whether the client should be granted access. An example policy file, `crossdomain.xml`, is shipped with the Flex adapter sample. This parameter is optional. | `PolicyFile="crossdomain.xml"`
`Debug` | If set to `true`, traffic between the adapter and the Flex client is displayed in the Server Diagnostics view (when running in StreamBase Studio) or sent to standard output. | `Debug="true"`
`Schema` | The schema for tuples that are optionally sent by the Flex client application back to the StreamBase application containing the Flex adapter. This parameter is optional. |
    Schema=
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
     <schema name=\"schema:OutputAdapter1\"
       uuid=\"D41D8CD98F00B204E9800998ECF8427E\"/>
       <field name=\"f0\"
               size=\"4\" type=\"string\"/>
       <field name=\"f1\"
               type=\"int\"/>
     </schema>"

## Related Topics

- Using JDBC Data Sources

- SELECT Statement

- StreamBase Server Configuration XML

Back to Top ^