summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/att
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/att')
-rw-r--r--src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java b/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
index bc54a01..bdd15d4 100644
--- a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
+++ b/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
@@ -32,14 +32,20 @@ import javax.ws.rs.core.MultivaluedMap;
import com.att.nsa.mr.client.MRClientFactory;
import com.att.nsa.mr.client.MRConsumer;
+import java.util.List;
+
public class SimpleExampleConsumer {
private static final Logger logger = LoggerFactory.getLogger(SimpleExampleConsumer.class);
+ private SimpleExampleConsumer() {
+ }
+
public static void main(String[] args) {
long count = 0;
long nextReport = 5000;
+ String key;
final long startMs = System.currentTimeMillis();
@@ -48,22 +54,23 @@ public class SimpleExampleConsumer {
final MRConsumer cc = MRClientFactory.createConsumer("D:\\SG\\consumer.properties");
while (true) {
for (String msg : cc.fetch()) {
-
- System.out.println("Message Received: " + msg);
+ logger.debug("Message Received: " + msg);
}
// Header for DME2 Call.
MultivaluedMap<String, Object> headersMap = MRClientFactory.HTTPHeadersMap;
- for (String key : headersMap.keySet()) {
- System.out.println("Header Key " + key);
- System.out.println("Header Value " + headersMap.get(key));
+ for (MultivaluedMap.Entry<String,List<Object>> entry: headersMap.entrySet()) {
+ key = entry.getKey();
+ logger.debug("Header Key " + key);
+ logger.debug("Header Value " + headersMap.get(key));
}
// Header for HTTP Call.
- Map<String, String>
- dme2headersMap=MRClientFactory.DME2HeadersMap; for(String key
- : dme2headersMap.keySet()) { System.out.println("Header Key "
- + key); System.out.println("Header Value " +
- dme2headersMap.get(key)); }
+ Map<String, String> dme2headersMap=MRClientFactory.DME2HeadersMap;
+ for(Map.Entry<String,String> entry: dme2headersMap.entrySet()) {
+ key = entry.getKey();
+ logger.debug("Header Key " + key);
+ logger.debug("Header Value " + dme2headersMap.get(key));
+ }
if (count > nextReport) {
nextReport += 5000;
@@ -72,12 +79,11 @@ public class SimpleExampleConsumer {
final long elapsedMs = endMs - startMs;
final double elapsedSec = elapsedMs / 1000.0;
final double eps = count / elapsedSec;
- System.out.println("Consumed " + count + " in " + elapsedSec + "; " + eps + " eps");
+ logger.error("Consumed " + count + " in " + elapsedSec + "; " + eps + " eps");
}
}
} catch (Exception x) {
- System.err.println(x.getClass().getName() + ": " + x.getMessage());
- logger.error("exception: ", x);
+ logger.error(x.getClass().getName() + ": " + x.getMessage());
}
}
}