CSV Socket Reader Input Adapter

Introduction

The TIBCO StreamBaseĀ® CSV Socket Reader is an embedded adapter that reads CSV data from a socket. It closely resembles the CSV File Reader adapter.

Unlike the CSV File Reader adapter, though, this socket adapter reads input data from a TCP socket connected to a specified external address. Also unlike the file reader, the input source of this adapter is indefinite and naturally timed, so repetition and timing are not specified as properties.

Properties

Property Description
Server Mode Select this check box to have the adapter operate in server mode, listening for and accepting incoming connections from remote clients.
Max Connection Count A positive integer representing the maximum number of simultaneous incoming connections the adapter accepts in server mode. The minimum entry is 1.
Host Name The host or IP address to connect to when not in server mode.
Port The TCP port to connect to, or in server mode, to listen on.
Use Default Charset If selected, specifies whether the Java platform default character set is to be used. If cleared, a valid character set name must be specified for the Character Set property.
Character Set The name of the character set encoding that the adapter is to use to read input or write output.
Capture Transform Strategy The strategy to use when transforming capture fields for this operator: FLATTEN or NEST.
Field Delimiter The delimiter used to separate tokens, defaults to a comma. Control characters can be entered as &#ddd; where ddd is the character's ASCII value. A special exception also allow the \t character to be used in this field to represent a tab delimiter.
String Quote Character Matching pairs of the quote character delimiter string constants.
Timestamp Format The format used to parse timestamp fields extracted from the input tuples. This should be in the form expected by java.text.SimpleDateFormat class described in Java Platform SE reference documentation. The default format string is yyyy-MM-dd HH:mm:ss.SSSZ.

If a timestamp value is read that does not match the specified format string, the entire record is discarded and a WARN message appears on the console that includes the text invalid timestamp value.

Lenient Parsing

Set this to true if you would like to parse timestamp values that do not conform to the specified format using default formats.

Incomplete Records

Specifies what should be done when the adapter receives a record with less than the required number of fields.

Discard

Discard records with less than the required number of fields.

Populate with nulls

When records with less than the required number of fields are encountered, process the records after populating the unspecified fields with nulls.

Discard Empty Records

This is a special case to handle empty lines. If rows with some fields must send output, but not empty lines, leave this selected. Unselect this to send empty tuples for empty lines.

Log Warning

Select this check box if warning messages should be logged when incomplete records are encountered. If unchecked, no warning messages will be logged for records with less than required number of fields.

Reconnect Count The number of times the adapter should try to reconnect to the socket when not in server mode. Zero, the default, means attempt to reconnect indefinitely.
Poll Period The time, in seconds, to wait between reconnect attempts. The default is 5 seconds.
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.
Schema (in the Edit Schemas tab) Specifies the schema of the incoming CSV file.

Typechecking and Error Handling

Typechecking will fail if the Delimiter or QuoteChar are not single character strings, or if the TimestampFormat is malformed.

Suspend and Resume Behavior

On suspend, this adapter closes its input socket.

On resumption, it reconnects its socket and continues reading tuples from it.

This adapter does not leave its socket open during suspend because the input source is naturally timed, so the input source itself cannot be paused. Leaving the socket open could lead to buffering problems, ultimately causing the socket to close with an error.