aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authordglFromAtt <dgl@research.att.com>2018-11-10 14:23:57 -0500
committerdglFromAtt <dgl@research.att.com>2018-11-10 14:24:09 -0500
commit1813f193a734bf77629d9b9bda7ecf6582581569 (patch)
tree3aa8b147784ce2d6121e73f157539cef524f9747 /src/main
parent1360b9df89a422d51ef40644ea5f9cf52cb84c6f (diff)
Catch topic already assigned to mmagent
Change-Id: I75c9fffc2785cb59bac9e7ccaddebfec72b4c6e1 Signed-off-by: dglFromAtt <dgl@research.att.com> Issue-ID: DMAAP-880
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/MirrorMakerService.java9
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/MirrorMakerService.java b/src/main/java/org/onap/dmaap/dbcapi/service/MirrorMakerService.java
index 8acc4f3..382e536 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/MirrorMakerService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/MirrorMakerService.java
@@ -155,7 +155,7 @@ public class MirrorMakerService extends BaseLoggingClass {
return ret;
}
- public MirrorMaker getNextMM( String source, String target ) {
+ public MirrorMaker getNextMM( String source, String target, String fqtn ) {
int i = 0;
MirrorMaker mm = null;
while( mm == null ) {
@@ -164,6 +164,9 @@ public class MirrorMakerService extends BaseLoggingClass {
if ( mm == null ) {
mm = new MirrorMaker(source, target, i);
}
+ if ( mm.getTopics().contains(fqtn) ) {
+ break;
+ }
if ( mm.getTopicCount() >= maxTopicsPerMM ) {
logger.info( "getNextMM: MM " + mm.getMmName() + " has " + mm.getTopicCount() + " topics. Moving to next MM");
i++;
@@ -177,17 +180,17 @@ public class MirrorMakerService extends BaseLoggingClass {
public MirrorMaker splitMM( MirrorMaker orig ) {
- int index = 1;
String source = orig.getSourceCluster();
String target = orig.getTargetCluster();
ArrayList<String> whitelist = orig.getTopics();
while( whitelist.size() > maxTopicsPerMM ) {
- MirrorMaker mm = this.getNextMM( source, target );
+
int last = whitelist.size() - 1;
String topic = whitelist.get(last);
whitelist.remove(last);
+ MirrorMaker mm = this.getNextMM( source, target, topic );
mm.addTopic(topic);
this.updateMirrorMaker(mm);
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
index a633982..56ed967 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
@@ -433,7 +433,7 @@ public class TopicService extends BaseLoggingClass {
if ( source != null && target != null ) {
try {
logger.info( "Create a MM from " + source + " to " + target );
- MirrorMaker mm = bridge.getNextMM( source, target);
+ MirrorMaker mm = bridge.getNextMM( source, target, topic.getFqtn());
mm.addTopic(topic.getFqtn());
bridge.updateMirrorMaker(mm);
} catch ( Exception ex ) {