You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/12/11 15:36:59 UTC
[1/2] git commit: handling ClusterCreatedEvent in SM
Updated Branches:
refs/heads/master bd8328e98 -> 5f2b80449
handling ClusterCreatedEvent in SM
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9446670b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9446670b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9446670b
Branch: refs/heads/master
Commit: 9446670bb3b150ff578138eb04e111ddad2b918b
Parents: e62bdd7
Author: Isuru <is...@wso2.com>
Authored: Wed Dec 11 20:06:15 2013 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Dec 11 20:06:15 2013 +0530
----------------------------------------------------------------------
.../processor/ClusterStatusEventProcessor.java | 48 ++++++++++++++++++--
1 file changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9446670b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/topology/event/processor/ClusterStatusEventProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/topology/event/processor/ClusterStatusEventProcessor.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/topology/event/processor/ClusterStatusEventProcessor.java
index ed73500..4539799 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/topology/event/processor/ClusterStatusEventProcessor.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/topology/event/processor/ClusterStatusEventProcessor.java
@@ -24,7 +24,10 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.adc.mgt.dao.CartridgeSubscriptionInfo;
import org.apache.stratos.adc.mgt.topology.model.TopologyClusterInformationModel;
import org.apache.stratos.adc.mgt.utils.PersistenceManager;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.event.topology.ClusterCreatedEvent;
import org.apache.stratos.messaging.event.topology.ClusterRemovedEvent;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
import org.apache.stratos.messaging.util.Constants;
import org.apache.stratos.messaging.util.Util;
@@ -60,18 +63,35 @@ public class ClusterStatusEventProcessor extends TopologyEventProcessor {
log.info("Received Cluster Status message: " + messageType);
- if (ClusterRemovedEvent.class.getName().equals(messageType)) {
+ if (ClusterCreatedEvent.class.getName().equals(messageType)) {
log.info("Received message: " + messageType);
- ClusterRemovedEvent event = getClusterRemovedEvent(message);
+ ClusterCreatedEvent event = getClusterCreatedEvent(message);
+ CartridgeSubscriptionInfo cartridgeSubscriptionInfo =
+ getCartridgeSubscriptionInfo(event.getClusterId());
+
+ if (cartridgeSubscriptionInfo != null) {
+
+ Cluster cluster = TopologyManager.getTopology().
+ getService(cartridgeSubscriptionInfo.getCartridge()).getCluster(cartridgeSubscriptionInfo.getClusterDomain());
+ //add the new cluster to the Topology Cluster Info. model
+ TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscriptionInfo.getTenantId(),
+ cartridgeSubscriptionInfo.getCartridge(),
+ cartridgeSubscriptionInfo.getAlias(),
+ cluster);
+ }
+ } else if (ClusterRemovedEvent.class.getName().equals(messageType)) {
+
+ log.info("Received message: " + messageType);
+
+ ClusterRemovedEvent event = getClusterRemovedEvent(message);
CartridgeSubscriptionInfo cartridgeSubscriptionInfo =
getCartridgeSubscriptionInfo(event.getClusterId());
if (cartridgeSubscriptionInfo != null) {
//remove the information from Topology Cluster Info. model
-
TopologyClusterInformationModel.getInstance().removeCluster(cartridgeSubscriptionInfo.getTenantId(),
cartridgeSubscriptionInfo.getCartridge(),
cartridgeSubscriptionInfo.getAlias());
@@ -79,6 +99,28 @@ public class ClusterStatusEventProcessor extends TopologyEventProcessor {
}
}
+ private ClusterCreatedEvent getClusterCreatedEvent (Message message) {
+
+ String json = null;
+ try {
+ json = ((TextMessage)message).getText();
+
+ } catch (JMSException e) {
+ log.error("Error in getting Json message type from received Message ", e);
+ return null;
+ }
+ ClusterCreatedEvent event = (ClusterCreatedEvent) Util.jsonToObject(json, ClusterCreatedEvent.class);
+
+ if(log.isDebugEnabled()) {
+ log.debug("Received message details: [ " +
+ "Cluster Id: " + event.getClusterId() +
+ "\nHost name: " + event.getHostName() +
+ "\nService name: " + event.getServiceName() + " ]");
+ }
+
+ return event;
+ }
+
private ClusterRemovedEvent getClusterRemovedEvent (Message message) {
String json = null;
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/5f2b8044
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5f2b8044
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5f2b8044
Branch: refs/heads/master
Commit: 5f2b80449b0731afc50acc503ed0e84f66665217
Parents: 9446670 bd8328e
Author: Isuru <is...@wso2.com>
Authored: Wed Dec 11 20:06:43 2013 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Dec 11 20:06:43 2013 +0530
----------------------------------------------------------------------
.../CompleteTopologyMessageProcessor.java | 18 +++
.../executionplans/AverageHeathRequest.xml | 7 +-
.../AverageRequestsInflightFinder.xml | 6 +-
.../executionplans/GradientOfHealthRequest.xml | 17 ++-
.../GradientOfRequestsInFlightFinder.xml | 8 +-
.../SecondDerivativeOfHealthRequest.xml | 12 +-
...SecondDerivativeOfRequestsInFlightFinder.xml | 8 +-
.../stream-manager-config.xml | 18 +++
.../distribution/src/main/assembly/bin.xml | 8 +-
.../distribution/src/main/conf/autoscaler.drl | 81 ------------
.../distribution/src/main/conf/mincheck.drl | 73 +++++++++++
.../distribution/src/main/conf/scaling.drl | 127 +++++++++++++++++++
.../src/main/bin/health-publisher.sh | 2 +-
.../agent/health/publisher/HealthPublisher.java | 22 ++--
14 files changed, 281 insertions(+), 126 deletions(-)
----------------------------------------------------------------------