I'm using version 0.0.8 of the TimeSeries Java Client to ingest data.
The calls work fine (data is appearing in the Timeseries Instance), but the Java Client always returns an IngestionResponse with 'null' values. Looking through the decompiled source (in IntelliJ) it looks like it's returning a valid JSON response, but then throwing a (caught) NullPointerException because the Response isn't in the PendingIngestionsMap.
In ClientFactory.java
private synchronized Set<MessageHandler> getMessageHandlers() {
if(null == this.messageHandlers) {
this.messageHandlers = new HashSet();
this.messageHandlers.add(new Whole<String>() {
private Logger logger = LoggerFactory.getLogger(Whole.class);
public void onMessage(String message) {
this.logger.info("Received message: " + message);
IngestionResponse resp = (IngestionResponse)(new Gson()).fromJson(message, IngestionResponse.class);
IngestionResponse response = (IngestionResponse)PredixTimeseriesWebSocketIngestionClient.this.pendingIngestionsMap.get(resp.getMessageId());
response.setMessageId(resp.getMessageId());
response.setStatusCode(resp.getStatusCode());
response.getLatch().countDown();
}
});
}
return this.messageHandlers;
}
Is anyone else seeing this behaviour?
Cheers, Dan
Answer by Thuan Truong · May 10, 2017 at 03:42 PM
Hi @Dan Salt,
You need to set ingestion wait timeout in tenant context in order to receive the response (by default it the timeout is 0, so you always got the null response).
tenant.setIngestionWaitTimeout(ingestionWaitTimeout);
If you create the tenant context by this method TenantContextFactory.createTenantContextFromPropertiesFile(), you can specify the ingestion wait timeout property:
ingestion.response.wait.timeout
Thanks,
Thuan