Sample program source code:
1 | import java.io.BufferedOutputStream; |
The following data are obtained from the arguments at runtime:
Argument | Variable | Use |
---|---|---|
1 | hostName | CEP Server host name |
2 | port | Socket adapter port |
3 | dataType | Event data format |
4 | charSet | Character set |
5 | eventTypeId | Event type ID |
6 | data | Event data |
7 | lWait | Data transmission wait time |
8 | loop | Data transmission count |
9 | dataCount | Number of event data to send at a time |
An example of sample execution is shown below.
In this example, debug information is output to the engine log by using DebugLogListener.
Command execution result
# java -cp ./ SocketClient localhost 8001 CSV UTF-8 CSVEvent SOCKET,CSV,%COUNTER% 1 2 2 <ENTER>
RESPONSE:0000:6:Sending message completed normally.
Engine log output result
2012-07-29 13:27:49,410 [DEBUG] abc:length=1
abc[0]
operation :CSV: String
count :0: String
ID :SOCKET: String
2012-07-29 13:27:49,422 [DEBUG] abc:length=1
abc[0]
operation :CSV: String
count :1: String
ID :SOCKET: String
2012-07-29 13:27:49,427 [DEBUG] abc:length=1
abc[0]
operation :CSV: String
count :2: String
ID :SOCKET: String
2012-07-29 13:27:49,428 [DEBUG] abc:length=1
abc[0]
operation :CSV: String
count :3: String
ID :SOCKET: String
An example of sample execution is shown below.
In this example, debug information is output to the engine log by using DebugLogListener.
Command execution result
# java -cp ./ SocketClient localhost 8001 XML UTF-8 XMLEvent '<?xml version="1.0"\ encoding="UTF-8"?><XMLEvent><ID>SOCKET</ID> <operation>XML</operation>\ <count>%COUNTER%</count></XMLEvent>' 1 2 2 <ENTER>
RESPONSE:0000:4:Sending message completed normally.
Please note that we added backslash ("\") and newline characters in the command line example above for readability only - the actual command line does not have a backslash and newline.
Engine log output result
2012-07-29 13:30:56,861 [DEBUG] abc--0:length=1
abc--0[0]
operation :XML: String
count :0: String
ID :SOCKET: String
2012-07-29 13:30:56,862 [DEBUG] abc--0:length=1
abc--0[0]
operation :XML: String
count :1: String
ID :SOCKET: String
2012-07-29 13:30:56,865 [DEBUG] abc--0:length=1
abc--0[0]
operation :XML: String
count :2: String
ID :SOCKET: String
2012-07-29 13:30:56,865 [DEBUG] abc--0:length=1
abc--0[0]
operation :XML: String
count :3: String
ID :SOCKET: String