public ContinuousChangesFeed(String dbName, HttpResponse httpResponse) { this.httpResponse = httpResponse; try { reader = new BufferedReader(new InputStreamReader(httpResponse.getContent(), "UTF-8")); thread.setName( String.format( "ektorp-%s-changes-listening-thread-%s", dbName, THREAD_COUNT.getAndIncrement())); thread.start(); } catch (UnsupportedEncodingException e) { throw Exceptions.propagate(e); } }
@SuppressWarnings("unchecked") @Override public String success(HttpResponse hr) throws Exception { Map<String, ?> rsp = objectMapper.readValue(hr.getContent(), Map.class); return (String) rsp.get(REVISION_FIELD_NAME); }
@Override public DocumentOperationResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), DocumentOperationResult.class); }