Class for input: RealTimeClient
Reference for the RealTimeClient
class, used for sending input data to the Web Service connector.
You must compile your implementation against RealTimeClient.jar
.
The RealTimeClient
class has two methods:
getInstance
postRealTimeData
Code example
Here is a code example. The code opens an HTTP connection to the Interact Connector servlet and sends transaction data.
private static
String
urlString ="http://detectvm2.emmlabs.ibm.com:8282/servlets/StreamServlet";
RealTimeServletClient
streamServletRealTimeClient = RealTimeServletClientImpl.getInstance(urlString);
String
deploymentConfigurationId = "e0692797-70fc-4a34-9232-9f7df3e9bb68";
int version = 5;
String audienceId = "Acc09";
String inputDataSourceName = "RealTimeDataSource";
Map inputDataSourceFields = new Hashtable();
// The names of the keys below are the names of datasource fields.
// Start of transaction
inputDataSourceFields.put("Boolean", true);
inputDataSourceFields.put("Timestamp", new Date().getTime());
inputDataSourceFields.put("Double", 99.9);
inputDataSourceFields.put("Integer", 56);
inputDataSourceFields.put("String", "Hello");
inputDataSourceFields.put("AudienceId", audienceId);
// End of transaction
streamServletRealTimeClient.postRealTimeData
(deploymentConfigurationId, version, audienceId,
inputDataSourceName, inputDataSourceFields);
In the example, the fields in the transaction hash table are defined on the Detect Settings > Data Sources page as shown below.
Additional details are provided in the remainder of this section.