The Spotfire Streaming Web Input Response Adapter allows the StreamBase application to respond to a REST call that was handled by the Web Input adapter. The adapter must be linked to a Web Input Adapter by selecting the Web Input Adapter and setting its Linked Web Input Response adapter name to this adapter. The Web Input Adapter will output an extra SB_ResponseId field that will contain a unique identifier for each REST request received, which is used to correlate the connection for the response. This adapter uses the ResponseId field to create a JSON-formatted response based on the input schema. Note the SB_ResponseId, SB_RequestData, and SB_ResponseData fields are removed from the JSON-formatted REST response.
This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.
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.
Property | Type | Description |
---|---|---|
WebStream Configuration | Edit Button |
Shortcut to the StreamBase Configuration File Editor, used for
adapter configuration or converting an existing application's adapter-configurations.xml file to HOCON format.
|
Timestamp Format | string | The timestamp format used to convert timestamp fields to JSON. |
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.
Use the input port to determine the schema of the REST response. Any tuples entering this port are sent directly out on the output port untouched. The special fields SB_ResponseId, SB_RequestData, and SB_ResponseData are removed from the tuple before creating a JSON response for the HTTP Request.
The SB_ResponseData field allows for some control over the http response object such as adding cookies and headers. This tuple must conform to the following format with all fields being optional:
-
StatusCode (int)—If available this field is used to set the status code of the http response.
-
HttpHeaders (list(tuple))—If available this field is used to set outbound http headers
-
Key (string)—The header name
-
Value (string)—The header value
-
-
Cookies (list(tuple))—If available this field is used to set outbound cookies
-
Name (string)—Assigns a name to this cookie
-
Value (string)—Assigns a new value to this cookie
-
MaxAge (int)—Sets the maximum age in seconds for this cookie
-
Comment (string)—Specifies a comment that describes a cookie's purpose
-
Domain (string)—Specifies the domain within which this cookie should be presented
-
HttpOnly (boolean)—Marks or unmarks this cookie as HttpOnly
-
Path (string)—Specifies a path for the cookie to which the client should return the cookie
-
Secure (boolean)—Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL
-
Version (int)—Sets the version of the cookie protocol that this cookie complies with
-
Only exactly one webstream configuration is allowed per application, which all adapters will use if found.
This example configuration shows a web server that contains all available values.
name = "WebStream.conf" type = "com.tibco.ep.streambase.configuration.adapter" version = "1.0.0" configuration = { // An adapter group type defines a collection of EventFlow adapter configurations, indexed by adapter type. AdapterGroup = { // A collection of EventFlow adapter configurations, indexed by adapter type. This key is required and must contain at // least one configuration. adapters = { // The root section for an EventFlow adapter configuration. webstreams = { // Section list. This key is optional and has no default value. sections = [ // A configuration for an EventFlow adapter named section. { // Section name. The value does not have to be unique; that is, you can have multiple sections with the same name // in the same array of sections. This key is required. name = "webstreams" // Section property bag. All values must be strings. This key is optional and has no default value. settings = { Enabled = "true" IdleTimeoutMS = "0" OutputBufferSize = "32768" Port = "10090" RequestHeaderSize = "8192" ResponseHeaderSize = "8192" SendDateHeader = "false" SendServerVersion = "true" StartOnStartup = "true" WebSocketAsyncWriteTimeoutMS = "0" WebSocketIdleTimeoutMS = "0" SelectorThreads = "-1" AcceptorThreads = "-1" ReuseAddress = "true" LingerTime = "-1" GZipMimeTypes = "text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,text/javascript,image/svg+xml" SecurePort = "10443" SSLKeyStorePath = "keystore" SSLKeyStorePassword = "tester" SSLKeyStoreManagerPassword = "tester" SSLTrustStorePath = "keystore" SSLTrustStorePassword = "tester" } } ] } } } }
Setting | Type | Description |
---|---|---|
Enabled | true/false | If true the web server and all ports are started. If false no web server is started and all operators become no-ops. |
Port | integer | The port the web server will listen on for connections. |
IdleTimeoutMS | integer | The amount of time in milliseconds to wait for connections to send data. |
OutputBufferSize | integer | Set the size of the buffer into which response content is aggregated before being sent to the client. |
RequestHeaderSize | integer | Set the maximum size of a request header. |
ResponseHeaderSize | integer | Set the maximum size of a response header. |
SendServerVersion | true/false | If true, send the Server header in responses. |
SendDateHeader | true/false | If true, include the date in HTTP headers. |
SelectorThreads | int | The number of selector threads, or less than or equal to 0 for a default value. Selectors notice and schedule established connection that can make IO progress. |
AcceptorThreads | int | The number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections. |
ReuseAddress | true/false | Whether the server socket reuses addresses. |
LingerTime | integer | The linger time. Use -1 to disable. |
GZipMimeTypes | string | Set the mime types associated with GZip requests. Blank or missing means do not use GZip. |
WebSocketAsyncWriteTimeoutMS | integer | The time in milliseconds before a write command times out. |
WebSocketIdleTimeoutMS | integer | The time in milliseconds before a web socket times out from idle behavior. |
SecurePort | integer | Set the TCP/IP port used for CONFIDENTIAL and INTEGRAL redirections. |
* SSLKeyStorePath | string | The file or URL of the SSL keystore. |
* SSLKeyStorePassword | string | The password for the keystore. |
* SSLKeyStoreManagerPassword | string | The password (if any) for the specific key within the keystore. |
* SSLTrustStorePath | string | The file name or URL of the trust store location. |
* SSLTrustStorePassword | string | The password for the trust store. |
* NOTE: Please refer to http://wiki.eclipse.org/Jetty/Howto/Configure_SSL when setting up SSL.