on 05-30-2014 4:23 AM
Here is the ccl code:
CREATE INPUT WINDOW InputWindow1 SCHEMA (
id INTEGER ,
name string ,
age INTEGER ) PRIMARY KEY ( id ) KEEP ALL ROWS ;
ATTACH INPUT ADAPTER Socket_CSV_Input1 TYPE toolkit_socket_csv_input TO InputWindow1 PROPERTIES host = '10.128.162.179' ,
port = 4700 ,
csvExpectStreamNameOpcode = FALSE ,
csvDelimiter = ',' ,
csvHasHeader = FALSE ;
And I have a simple JAVA socketserver to publish data, and here is the java code:
However, when I tried to run the java project and esp project, I got nothing in the window. The log file in esp said that:
received record for unknown stream. Index: 16
In the java project console, it shows that the socketserver worked fine, and publish data every 1 second.
So, how can I fix this problem?
Hi Kevin,
Check your project's "frameworkadapter.log" file. It will contain errors related to the toolkit based adapters (identifiable by the TYPE in your CCL). When I run your reproduction I see:
05-30-2014 14:08:52.239 ERROR [Thread-18] (CSVInputFormatter.parseCSV) Error code:402002, Severity : 3 (Error)
Error message:CSV line contains 1 fields, expected 3.
Error description:CSV line contains 1 fields, expected 3.
05-30-2014 14:08:52.240 ERROR [Thread-18] (CSVInputFormatter.convert) Error code:402005, Severity : 3 (Error)
Error message:CSV Formatter failed to convert a string: ??
This tells me that there is a mismatch in what your Java program is sending and what the ESP adapter is expecting. I think ObjectOutputStream sends some extra information. According to the Java docs (http://docs.oracle.com/javase/7/docs/api/java/io/ObjectOutputStream.html), ObjectOutputStream outputs:
"Primitive data, excluding serializable fields and externalizable data, is written to the ObjectOutputStream in block-data records. A block data record is composed of a header and data. The block data header consists of a marker and the number of bytes to follow the header. Consecutive primitive data writes are merged into one block-data record. The blocking factor used for a block-data record will be 1024 bytes. Each block-data record will be filled up to 1024 bytes, or be written whenever there is a termination of block-data mode. Calls to the ObjectOutputStream methods writeObject, defaultWriteObject and writeFields initially terminate any existing block-data record."
I think ESP is just looking for a CSV string so if I change your code as follows it works for me:
//private ObjectOutputStream out;
private PrintStream out;
//out = new ObjectOutputStream(client.getOutputStream());
out = new PrintStream(client.getOutputStream(),true);
out.println(++i + ",kevin,20");
//out.writeObject(++i + ",kevin,20");
//out.flush();
If you are not sure what format an adapter is expecting, it helps to look at the "adapter_config.xml" file (%ESP_HOME%\adapters\framework\instances\socket_csv_input\adapter_config.xml) and then look at either:
Thanks,
Neal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
26 | |
10 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.