aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main/java
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-03-04 16:03:34 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-04 16:03:35 -0500
commita74ad913699bcb4fb956d8088d57be248baa5dc2 (patch)
tree0e2d72fe14397f89212ec8846050871790592ecf /common/src/main/java
parent97e7341e1206442f286900a3441bda96430e43b3 (diff)
Remove accepted check
accepted check no longer required Issue-ID: SO-2712 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I224a88f0665985a7cb59302b5ad7d6251b4bab0e
Diffstat (limited to 'common/src/main/java')
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 4de546e9da..cbad59e968 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -20,12 +20,12 @@
package org.onap.so.client.dmaap;
-import com.google.common.base.Stopwatch;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
import org.onap.so.client.dmaap.rest.RestConsumer;
+import com.google.common.base.Stopwatch;
public abstract class DmaapConsumer extends DmaapClient {
static final int MAX_ELAPSED_TIME = 180000;
@@ -40,7 +40,6 @@ public abstract class DmaapConsumer extends DmaapClient {
public boolean consume() throws Exception {
Consumer mrConsumer = this.getConsumer();
- boolean accepted = false;
Stopwatch stopwatch = Stopwatch.createUnstarted();
try {
while (this.continuePolling()) {
@@ -54,20 +53,17 @@ public abstract class DmaapConsumer extends DmaapClient {
Iterable<String> itr = mrConsumer.fetch();
stopwatch.stop();
for (String message : itr) {
- if (!accepted && this.isAccepted(message)) {
+ if (this.isAccepted(message)) {
logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
- accepted = true;
}
- if (accepted) {
- logger.info("received dmaap message: " + message);
- if (this.isFailure(message)) {
- this.stopProcessingMessages();
- final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- logger.error(errorMsg);
- throw new DMaaPConsumerFailure(errorMsg);
- } else {
- this.processMessage(message);
- }
+ logger.info("received dmaap message: " + message);
+ if (this.isFailure(message)) {
+ this.stopProcessingMessages();
+ final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+ logger.error(errorMsg);
+ throw new DMaaPConsumerFailure(errorMsg);
+ } else {
+ this.processMessage(message);
}
}
}