geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r348125 - in /geronimo/gbuild/trunk: gbuild-agent-application/src/conf/application.xml gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java gbuild-agent/src/main/resources/META-INF/plexus/components.xml
Date Tue, 22 Nov 2005 07:59:30 GMT
Author: dblevins
Date: Mon Nov 21 23:59:24 2005
New Revision: 348125

URL: http://svn.apache.org/viewcvs?rev=348125&view=rev
Log:
Added something to consume pings off the BUILD.PING topic.  Doesn't seem like the topic actually
exists till there is at least one consumer for it, which would make sense.

Added:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
Modified:
    geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml
    geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml

Modified: geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml?rev=348125&r1=348124&r2=348125&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml Mon Nov 21 23:59:24
2005
@@ -14,7 +14,11 @@
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>build-results</role-hint>
     </component>
--->    
+    <component>
+      <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+      <role-hint>ping-monitor</role-hint>
+    </component>
+-->
   </load-on-start>
 
   <resources>

Added: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java?rev=348125&view=auto
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
(added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
Mon Nov 21 23:59:24 2005
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.gbuild.agent;
+
+import javax.jms.Session;
+import javax.jms.MessageConsumer;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+import javax.jms.JMSException;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PingMonitorAgent extends AbstractContinuumBuildAgent {
+
+    private String subject = "BUILD.PING";
+
+    public void execute(Map context) throws Exception {
+    }
+
+    public void run() {
+        try {
+            getLogger().info("Ping Agent starting. ("+coordinatorUrl+")");
+            getLogger().debug("coordinatorUrl " + coordinatorUrl);
+
+            while (isRunning()){
+                Client client = getClient();
+
+                Session session = client.getSession();
+
+                MessageConsumer consumer = createConsumer(session, subject);
+
+                try {
+                    while (client.isConnected() && isRunning()) {
+                        Message message = consumer.receive(1000);
+
+                        if (message == null){
+                            continue;
+                        } else if (message instanceof TextMessage) {
+                            TextMessage textMessage = (TextMessage) message;
+                            getLogger().info("Ping "+ message.getJMSMessageID() +" : "+ textMessage.getText());
+                        } else {
+                            getLogger().warn("Agent received incorrect message type: "+message.getClass().getName());
+                        }
+                    }
+                } catch (JMSException e) {
+                    getLogger().info("Burp. "+e.getMessage());
+                }
+            }
+        } catch (Exception e) {
+            getLogger().error("Agent failed.", e);
+        }
+
+    }
+}

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml?rev=348125&r1=348124&r2=348125&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml Mon
Nov 21 23:59:24 2005
@@ -162,5 +162,19 @@
         <date-format>yyyy-MM-dd</date-format>
       </configuration>
     </component>
+
+
+    <!--
+    | Ping monitor
+    -->
+    <component>
+      <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+      <role-hint>ping-monitor</role-hint>
+      <implementation>org.apache.geronimo.gbuild.agent.PingMonitorAgent</implementation>
+      <configuration>
+        <coordinator-url>tcp://localhost:61616</coordinator-url>
+      </configuration>
+    </component>
+
   </components>
 </component-set>



Mime
View raw message