- logger.info( "getBridgeTopics():" + " source=" + source + ", target=" + target);
- // System.out.println("getBridgedTopics() " + "source=" + source + ", target=" + target );
- if (source != null && target != null) { // get topics between 2 bridged locations
- brTopic.setBrSource(source);
- brTopic.setBrTarget(target);
- MirrorMaker mm = mmService.getMirrorMaker(source, target);
- if ( mm != null ) {
- brTopic.setTopicCount( mm.getTopicCount() );
- }
-
- logger.info( "topicCount [2 locations]: " + brTopic.getTopicCount() );
- }
- else if (source == null && target == null ) {
- List<String> mmList = mmService.getAllMirrorMakers();
- brTopic.setBrSource("all");
- brTopic.setBrTarget("all");
- int totCnt = 0;
- for( String key: mmList ) {
- int mCnt = 0;
- MirrorMaker mm = mmService.getMirrorMaker(key);
- if ( mm != null ) {
- mCnt = mm.getTopicCount();
- }
- logger.info( "Count for "+ key + ": " + mCnt);
- totCnt += mCnt;
- }
-
- logger.info( "topicCount [all locations]: " + totCnt );
- brTopic.setTopicCount(totCnt);
-
- }
- else {
-
- logger.error( "source or target is missing");
- check.setCode(Status.BAD_REQUEST.getStatusCode());
- check.setMessage("Either both source and target or neither must be provided");
- return check.error();
- }
- return check.success(brTopic);
- } else {
-
+ // get topics between 2 bridged locations
+
+ MirrorMaker mm = mmService.getMirrorMaker(mmagent);
+ if ( mm == null ) {
+ return responseBuilder.notFound();
+ }
+
+ brTopic.setTopicCount( mm.getTopicCount() );
+ brTopic.setBrSource( mm.getSourceCluster());
+ brTopic.setBrTarget( mm.getTargetCluster());
+ brTopic.setMmAgentName(mm.getMmName());