Contents
You can optionally connect an output stream in a container to a csvfile URI that specifies the path to a CSV file, using the full
absolute path on the same system running sbd. This feature is primarily used for debugging and
analysis of your application.
A CSV container connection has an advantage over dequeuing from an output stream, which is that a CSV container connection starts working immediately on sbd startup (or on startup of the container). This means that even the first few tuples are captured in the specified CSV file. By contrast, it can take some time to start sbd, then start an sbc dequeue command, during which time you can miss the initial tuples.
To identify the path to a CSV file, use a URI in RFC 2396 format. The following is an example CSV container connection to an output stream:
sbadmin addContainer A appA.sbapp \
csvfile://home/sbuser/logs/appA-output.csv=A.Outgoing
Note
Remember that the syntax for expressing all forms of container connections is
always , like an assignment statement
in some programming languages.
destination=source
For paths on Windows machines, you must use the same URI syntax with forward slashes:
sbadmin addContainer A appA.sbapp \
csvfile://c/logs/appA-output.csv=A.Outgoing
Use URI encoding for any spaces in directory names:
sbadmin addContainer A appA.sbapp \
csvfile://c/Documents%20and%20Settings/sbuser/My%20Documents/logs/appA-output.csv=A.Outgoing
CSV container connections also work with input streams. In this case, the stream is fed from the contents of the incoming CSV file, whose fields, field order, and field data types must exactly match the schema of the input stream. The following is an example of a CSV container connection with an input stream:
sbadmin addContainer B appB.sbapp \
B.Incoming=csvfile://c/sbapps/appB-input.csv
The default settings for CSV files written or read in container connections are the defaults for the CSV File Writer and Reader adapters. For example, the default string quote character is the double-quote, and the default field delimiter is the comma.
When connecting an output stream to a CSV URI, your container connection command can change the defaults by specifying any property of the CSV File Writer adapter, as listed on CSV File Writer Output Adapter. Similarly, when connecting an input stream to a CSV URI, your command can specify any property of the CSV File Reader adapter, as listed on CSV File Reader Input Adapter.
To specify custom adapter options, enclose the CSV URI in parentheses, and use standard HTML-like URI syntax to separate adapter options in the same URI. That is, separate the first option with a question mark, and subsequent options with ampersands. Use the StreamSQL version of the adapter property names, which are usually the field names seen in the Properties view for an instance of the adapter, with spaces removed. If a property's value is a string in a dropdown list in the Properties view, use quotes to provide the exact same string in your CSV URI. For example:
sbadmin modifyContainer default addConnection \
(csvfile://home/sbuser/logs/out.csv?MaxFileSize=30&HeaderType="Ignore header")=default.OutputStream1
