AsapSource reads data from Event Stream Processor
and passes it to the JDBC lookup pipe. If required, the JDBC lookup pipe modifies the values
of the 'charfield' column by using 'replaceValue1', and passes that data to FileSource, which
then outputs that data to the file out.txt
file.
Prerequisites
The cluster database stores configuration information. Ensure that the cluster is
running, so that the adapter can interact with the projects on the
cluster.
Procedure
- Create a table and then fill the table with data. For example, for
a DB2 database, run the createTable_DB2.sql
script.
Modify this script to use it for any other databases.
- Update the DB properties in the JdbcLookupPipe.props file to point to the required database instance.
- Update the JdbcLookupPipe.bat or
JdbcLookupPipe.sh script, and add JDBC driver JARs in the
class path.
- Set the user name and password in the example environment:
Operating System |
Step |
Windows |
- Edit the set_example_env.bat script
- Set the ADAPTER_EXAMPLE_USERNAME and ADAPTER_EXAMPLE_PASSWORD
variables to the desired user name/password combination.
- If SSL is enabled, set
ADAPTER_EXAMPLE_CLUSTER_NODE_PROTOCOL to esps. If it is
disabled, set it to esp.
|
UNIX |
- Edit the set_example_env.sh script
- Set the ADAPTER_EXAMPLE_USERNAME and ADAPTER_EXAMPLE_PASSWORD
variables to the desired user name/password combination.
- If SSL is enabled, set
ADAPTER_EXAMPLE_CLUSTER_NODE_PROTOCOL to esps. If it is
disabled, set it to esp.
|
- Start SAP Event Stream Processor.
Operating System |
Step |
Windows |
Open a command window:- Start the cluster:
start_server_cluster.bat
- Add project to the cluster, and start it on the cluster:
start_project.bat
|
UNIX |
Open a terminal window: - Start the
cluster:
./start_server_cluster.sh
- Start the project on the cluster:
./start_project.sh
|
- Start streamingsubscribe to subscribe to the project that is
running on the cluster.
Operating System |
Step |
Windows |
Open a command window and
enter: streamingsubscribe.bat
|
UNIX |
Open a terminal window and enter:
./streamingsubscribe.sh
|
- Start the AsapSource, FileSink, and JDBCLookupPipe components.
Operating System |
Step |
UNIX |
Open a terminal window and enter: ./JdbcLookupPipe.sh
|
Windows |
Open a command window and enter: JdbcLookupPipe.bat
|
- Upload data to the Server.
Operating System |
Step |
UNIX |
Open a terminal window and enter:
./streamingupload.sh
|
Windows |
Open a command window and enter: streamingupload.bat
|
AsapSource reads this data (records) and passes it on to JDBCLookupPipe,
which modifies the records according to data available and reference data from the
database tables. JDBCLookupPipe then passes that data to FileSink, which then writes
the records to file.
- Table "test1" contains data "col1='AttributeKey'" and
"col2='replaceValue1'". 'KeyDbCol1' is col1 in the props file, therefore, col1
column contains attribute keys.
- These attribute keys are present in the incoming record column
'textfield'.
- To replace the 'charfield' column value of a record to
'replaceValue1', include 'AttributeKey' as a value in 'textfield' column of a
record
See the
esp_insert.txt file for more details. Records that
do not have 'AttributeKey' as the 'textfield' column value are not modified.
- See contents of the out.txt file.
Charfield data for some of the records is updated to 'replaceValue1' value.