labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r565720 - in /labs/pinpoint/trunk: pinpoint-cli/src/main/java/org/apache/logging/pinpoint/ pinpoint-core/src/main/java/org/apache/logging/pinpoint/ pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/ pinpoint-core/src/main/ja...
Date Tue, 14 Aug 2007 11:53:35 GMT
Author: psmith
Date: Tue Aug 14 04:53:34 2007
New Revision: 565720

URL: http://svn.apache.org/viewvc?view=rev&rev=565720
Log:
Disconnected the receiving of external events into the Pinpoint system via the Service
layer and decouple it by using ActiveMQ to buffer via an internal
JMS queue backed by a Derby db (all hail AMQ).

Now events should be able to be received as fast as possible even if indexing is slower
than the receive rate.

Also some tidy up of some search infrastructure.

Added:
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/LoggingEventHandler.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointEventWriterHandler.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedJMSLoggingEventHandler.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedLoggingEventJMSMessageListener.java
    labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/amq.xml
Modified:
    labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
    labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearchUtils.java
    labs/pinpoint/trunk/pinpoint-service/pom.xml
    labs/pinpoint/trunk/pinpoint-service/src/main/java/org/apache/logging/pinpoint/service/Service.java
    labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/pinpoint-context.xml

Modified: labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
(original)
+++ labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
Tue Aug 14 04:53:34 2007
@@ -65,6 +65,7 @@
     private EventStore eventStore;
     private Analyzer analyzer;
     private QueryParser queryParser;
+    private PinpointSearchUtils searchUtils;
 
     public Shell(PinpointContext ctx) {
         this.ctx = ctx;
@@ -163,6 +164,7 @@
 
         eventStore = new SimpleEventStore(ctx.getSerializationFile());
         pinpointSearcher = new PinpointSearcher(ctx, eventStore);
+        this.searchUtils = new PinpointSearchUtils(pinpointSearcher, eventStore);
 
         currentResults = null;
         try {
@@ -228,9 +230,8 @@
     }
 
     private void showInContext(int eventIndexOnCurrentPage) throws IOException {
-        Iterable<LoggingEvent> contextEvents = PinpointSearchUtils
-                .showEventInContext(pinpointSearcher, eventStore,
-                        currentResults, eventIndexOnCurrentPage);
+        Iterable<LoggingEvent> contextEvents = searchUtils.showEventInContext(
+                currentResults, eventIndexOnCurrentPage);
         displayEvents(contextEvents);
     }
 

Added: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/LoggingEventHandler.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/LoggingEventHandler.java?view=auto&rev=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/LoggingEventHandler.java
(added)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/LoggingEventHandler.java
Tue Aug 14 04:53:34 2007
@@ -0,0 +1,17 @@
+/*
+ * Copyright 1999-2005 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.logging.pinpoint;
+
+import org.apache.log4j.spi.LoggingEvent;
+
+public interface LoggingEventHandler {
+
+    public void handleEvent(LoggingEvent event);
+
+}

Modified: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
(original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
Tue Aug 14 04:53:34 2007
@@ -8,89 +8,31 @@
  */
 package org.apache.logging.pinpoint.converter;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.log4j.AppenderSkeleton;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
-import org.apache.logging.pinpoint.PinpointContext;
-import org.apache.logging.pinpoint.analyser.AnalyzerFactory;
-import org.apache.logging.pinpoint.selector.PinpointContextSelector;
-import org.apache.logging.pinpoint.store.EventStore;
-import org.apache.logging.pinpoint.store.SimpleEventStore;
+import org.apache.logging.pinpoint.LoggingEventHandler;
 
 public class PinpointAppender extends AppenderSkeleton {
 
-    private final PinpointContextSelector selector;
-
-    private Map<PinpointContext, PinpointContextContainer> contextMap = new HashMap<PinpointContext,
PinpointContextContainer>();
-
-    private final IndexWriterFactory indexWriterFactor;
+    private final LoggingEventHandler handler;
 
-    private final AnalyzerFactory analyserFactory;
-
-    public PinpointAppender(Logger logger, PinpointContextSelector selector,
-            IndexWriterFactory indexWriterFactory, AnalyzerFactory analyzerFactory) {
-        this.selector = selector;
-        this.indexWriterFactor = indexWriterFactory;
-        this.analyserFactory = analyzerFactory;
+    public PinpointAppender(Logger logger, LoggingEventHandler handler) {
+        this.handler = handler;
         logger.addAppender(this);
-        final PinpointAppender toClose = this;
-
-        // TODO this is to ensure things are flushed cleanly to the index if the process
is killed
-        // uncleanly.
-        Thread thread = new Thread(new Runnable() {
-
-            public void run() {
-                toClose.close();
-
-            }
-        });
-        Runtime.getRuntime().addShutdownHook(thread);
     }
 
     @Override
     protected void append(LoggingEvent event) {
-
-        // TODO this is going to be a huge bottleneck and needs to use some sort of background
-        // threading/JMS to process these
-        PinpointContext ctx = this.selector.selectFor(event);
-        try {
-            PinpointContextContainer container = contextMap.get(ctx);
-
-            if (container == null) {
-                container = new PinpointContextContainer();
-                EventStore store = new SimpleEventStore(ctx);
-
-                container.eventWriter = new EventWriter(store, ctx.getIndexDirectory(),
-                        indexWriterFactor, analyserFactory);
-                contextMap.put(ctx, container);
-            }
-            container.eventWriter.writeEvent(event);
-        } catch (IOException e) {
-            // TODO Handle failure
-            e.printStackTrace();
-        }
+        this.handler.handleEvent(event);
     }
 
     @Override
     public void close() {
-        for (Map.Entry<PinpointContext, PinpointContextContainer> entry : contextMap.entrySet())
{
-            entry.getValue().eventWriter.close();
-        }
-
     }
 
     @Override
     public boolean requiresLayout() {
         return false;
     }
-
-    // TODO is this container really needed?
-    private static class PinpointContextContainer {
-        private EventWriter eventWriter;
-    }
-
 }

Added: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointEventWriterHandler.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointEventWriterHandler.java?view=auto&rev=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointEventWriterHandler.java
(added)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointEventWriterHandler.java
Tue Aug 14 04:53:34 2007
@@ -0,0 +1,98 @@
+/*
+ * Copyright 1999-2005 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.logging.pinpoint.converter;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.pinpoint.LoggingEventHandler;
+import org.apache.logging.pinpoint.PinpointContext;
+import org.apache.logging.pinpoint.analyser.AnalyzerFactory;
+import org.apache.logging.pinpoint.selector.PinpointContextSelector;
+import org.apache.logging.pinpoint.store.EventStore;
+import org.apache.logging.pinpoint.store.SimpleEventStore;
+
+/**
+ * Handles events by writing to a {@link PinpointContext}, which is chosen by
+ * the provide {@link PinpointContextSelector}.
+ * 
+ * @author psmith
+ * 
+ */
+public class PinpointEventWriterHandler implements LoggingEventHandler {
+    private final PinpointContextSelector selector;
+
+    private Map<PinpointContext, PinpointContextContainer> contextMap = new HashMap<PinpointContext,
PinpointContextContainer>();
+
+    private final IndexWriterFactory indexWriterFactor;
+
+    private final AnalyzerFactory analyserFactory;
+
+    public PinpointEventWriterHandler(PinpointContextSelector selector,
+            IndexWriterFactory indexWriterFactory,
+            AnalyzerFactory analyzerFactory) {
+        this.selector = selector;
+        this.indexWriterFactor = indexWriterFactory;
+        this.analyserFactory = analyzerFactory;
+        final PinpointEventWriterHandler toClose = this;
+
+        // TODO this is to ensure things are flushed cleanly to the index if the
+        // process is killed
+        // uncleanly.
+        Thread thread = new Thread(new Runnable() {
+
+            public void run() {
+                toClose.close();
+
+            }
+        });
+        Runtime.getRuntime().addShutdownHook(thread);
+    }
+
+    public void handleEvent(LoggingEvent event) {
+
+        // TODO this is going to be a huge bottleneck and needs to use some sort
+        // of background
+        // threading/JMS to process these
+        PinpointContext ctx = this.selector.selectFor(event);
+        try {
+            PinpointContextContainer container = contextMap.get(ctx);
+
+            if (container == null) {
+                container = new PinpointContextContainer();
+                EventStore store = new SimpleEventStore(ctx);
+
+                container.eventWriter = new EventWriter(store, ctx
+                        .getIndexDirectory(), indexWriterFactor,
+                        analyserFactory);
+                contextMap.put(ctx, container);
+            }
+            container.eventWriter.writeEvent(event);
+        } catch (IOException e) {
+            // TODO Handle failure
+            e.printStackTrace();
+        }
+    }
+
+    public void close() {
+        for (Map.Entry<PinpointContext, PinpointContextContainer> entry : contextMap
+                .entrySet()) {
+            entry.getValue().eventWriter.close();
+        }
+
+    }
+
+    // TODO is this container really needed?
+    private static class PinpointContextContainer {
+        private EventWriter eventWriter;
+    }
+
+}

Added: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedJMSLoggingEventHandler.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedJMSLoggingEventHandler.java?view=auto&rev=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedJMSLoggingEventHandler.java
(added)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedJMSLoggingEventHandler.java
Tue Aug 14 04:53:34 2007
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1999-2005 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.logging.pinpoint.jms;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.pinpoint.LoggingEventHandler;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+
+/**
+ * 
+ * A {@link LoggingEventHandler} implementation that fowards the event to a
+ * given jmsTemplate that has been configured.
+ * 
+ * This is useful for buffering incoming events from some external source to be
+ * handled by a potentially slower consumer.
+ * 
+ * @author psmith
+ * 
+ */
+public class BufferedJMSLoggingEventHandler implements LoggingEventHandler {
+
+    private final JmsTemplate jmsTemplate;
+
+    public void handleEvent(final LoggingEvent event) {
+        jmsTemplate.send(new MessageCreator() {
+
+            public Message createMessage(Session session) throws JMSException {
+                return session.createObjectMessage(event);
+            }
+        });
+
+    }
+
+    public BufferedJMSLoggingEventHandler(JmsTemplate jmsTemplate) {
+        super();
+        this.jmsTemplate = jmsTemplate;
+    }
+
+}

Added: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedLoggingEventJMSMessageListener.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedLoggingEventJMSMessageListener.java?view=auto&rev=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedLoggingEventJMSMessageListener.java
(added)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/jms/BufferedLoggingEventJMSMessageListener.java
Tue Aug 14 04:53:34 2007
@@ -0,0 +1,52 @@
+package org.apache.logging.pinpoint.jms;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.pinpoint.LoggingEventHandler;
+import org.apache.logging.pinpoint.utils.PinpointUtils;
+
+/**
+ * A JMS Message conusmer class that wraps a {@link LoggingEventHandler}
+ * instance so as to pass on the {@link LoggingEvent} object to it after soaking
+ * it from the JMS bus.
+ * 
+ * @author psmith
+ * 
+ */
+public class BufferedLoggingEventJMSMessageListener implements MessageListener {
+
+    private static Logger LOG = PinpointUtils
+            .getLogger(BufferedLoggingEventJMSMessageListener.class);
+
+    private final LoggingEventHandler handler;
+
+    public BufferedLoggingEventJMSMessageListener(LoggingEventHandler handler) {
+        super();
+        this.handler = handler;
+    }
+
+    public void onMessage(Message message) {
+        if (message instanceof ObjectMessage) {
+            ObjectMessage objMessage = (ObjectMessage) message;
+            try {
+                LoggingEvent event = (LoggingEvent) objMessage.getObject();
+                handler.handleEvent(event);
+            } catch (JMSException e) {
+                LOG
+                        .error(
+                                "Failed to deserialize event from a JMS Message, eating the
message",
+                                e);
+            }
+
+        } else {
+            LOG.warn("Unexpected Message class " + message.getClass() +
+                    ", msg=" + message);
+        }
+    }
+
+}

Modified: labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearchUtils.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearchUtils.java?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearchUtils.java
(original)
+++ labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearchUtils.java
Tue Aug 14 04:53:34 2007
@@ -31,6 +31,14 @@
     // TODO shoud the searcher and eventStore be fields, and this method not
     // static? ie. should this helper class not be a static class
 
+    private final PinpointSearcher searcher;
+    private final EventStore eventStore;
+
+    public PinpointSearchUtils(PinpointSearcher searcher, EventStore eventStore) {
+        this.searcher = searcher;
+        this.eventStore = eventStore;
+    }
+
     /**
      * Returns an iterable item that shows all LoggingEvents around the chosen
      * event using the default context time Interval
@@ -42,9 +50,9 @@
      * @return
      * @throws IOException
      */
-    public static Iterable<LoggingEvent> showEventInContext(
-            PinpointSearcher searcher, EventStore eventStore,
-            PinpointSearchResults results, int chosenEventOnCurrentPage)
+    public Iterable<LoggingEvent> showEventInContext(
+
+    PinpointSearchResults results, int chosenEventOnCurrentPage)
             throws IOException {
         // TODO confirm this is +1 based
         String eventLocation = results.getPageResults().get(

Modified: labs/pinpoint/trunk/pinpoint-service/pom.xml
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-service/pom.xml?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-service/pom.xml (original)
+++ labs/pinpoint/trunk/pinpoint-service/pom.xml Tue Aug 14 04:53:34 2007
@@ -52,11 +52,16 @@
       <artifactId>log4j</artifactId>
       <version>${log4j.version}</version>
     </dependency>
-	 <dependency>
-	    <groupId>commons-daemon</groupId>
-	    <artifactId>commons-daemon</artifactId>
-	    <version>1.0.1</version>
-	</dependency>
+    <dependency>
+      <groupId>commons-daemon</groupId>
+      <artifactId>commons-daemon</artifactId>
+      <version>1.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>10.2.2.0</version>
+    </dependency>
   </dependencies>
   <properties>
     <log4j.receivers.version>1.1-SNAPSHOT</log4j.receivers.version>

Modified: labs/pinpoint/trunk/pinpoint-service/src/main/java/org/apache/logging/pinpoint/service/Service.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-service/src/main/java/org/apache/logging/pinpoint/service/Service.java?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-service/src/main/java/org/apache/logging/pinpoint/service/Service.java
(original)
+++ labs/pinpoint/trunk/pinpoint-service/src/main/java/org/apache/logging/pinpoint/service/Service.java
Tue Aug 14 04:53:34 2007
@@ -34,16 +34,19 @@
     }
 
     private void configure(String[] args) {
-        String basePackage = Service.class.getPackage().getName().replace('.', '/');
+        String basePackage = Service.class.getPackage().getName().replace('.',
+                '/');
         String config = "default-receiver-config.xml";
 
         System.setProperty("log4j.debug", "true");
         BasicConfigurator.resetConfiguration();
         BasicConfigurator.configure();
-        this.configs = new String[] { basePackage + "/" + "logger-repository.xml",
-                basePackage + "/" + "pinpoint-context.xml", basePackage + "/" + config,
+        this.configs = new String[] { "logger-repository.xml", "amq.xml",
+                "pinpoint-context.xml", config };
 
-        };
+        for (int i = 0; i < configs.length; i++) {
+            configs[i] = basePackage + "/" + configs[i];
+        }
     }
 
     public void destroy() {

Added: labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/amq.xml
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/amq.xml?view=auto&rev=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/amq.xml
(added)
+++ labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/amq.xml
Tue Aug 14 04:53:34 2007
@@ -0,0 +1,59 @@
+<beans 
+  xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:amq="http://activemq.org/config/1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+  http://activemq.org/config/1.0 http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-SNAPSHOT.xsd">
+  
+  <!--  lets create an embedded ActiveMQ Broker -->
+  <amq:broker useJmx="true" persistent="true">
+    <amq:transportConnectors>
+      <amq:transportConnector uri="tcp://localhost:0" />
+    </amq:transportConnectors>
+  </amq:broker>
+
+   <!--  ActiveMQ destinations to use  -->
+  <amq:queue id="destination"  physicalName="pinpointBufferedEventQueue"/>
+
+  <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
+  <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
+  
+  <!-- Spring JMS Template -->
+  <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
+    <property name="connectionFactory">
+      <!-- lets wrap in a pool to avoid creating a connection per send -->
+      <bean class="org.springframework.jms.connection.SingleConnectionFactory">
+        <property name="targetConnectionFactory">
+          <ref local="jmsFactory" />
+        </property>
+      </bean>
+    </property>
+    
+    <property name="defaultDestination" ref="destination" />
+  </bean>
+  
+  
+
+<!--  <bean id="consumerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
+    <property name="connectionFactory" ref="jmsFactory"/>
+  </bean>
+-->
+
+  <!-- a sample POJO which uses a Spring JmsTemplate -->
+  <!--
+  <bean id="producer" class="org.apache.activemq.spring.SpringProducer">
+    <property name="template">
+      <ref bean="myJmsTemplate"></ref>
+    </property>
+
+    <property name="destination">
+      <ref bean="destination" />
+    </property>
+
+    <property name="messageCount">
+      <value>10</value>
+    </property>
+  </bean>  
+ -->
+
+</beans>
\ No newline at end of file

Modified: labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/pinpoint-context.xml
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/pinpoint-context.xml?view=diff&rev=565720&r1=565719&r2=565720
==============================================================================
--- labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/pinpoint-context.xml
(original)
+++ labs/pinpoint/trunk/pinpoint-service/src/main/resources/org/apache/logging/pinpoint/service/pinpoint-context.xml
Tue Aug 14 04:53:34 2007
@@ -14,7 +14,8 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 
---><beans 
+-->
+<beans 
   xmlns="http://www.springframework.org/schema/beans" 
   xmlns:amq="http://activemq.org/config/1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -33,12 +34,29 @@
   
   <bean id="analyserFactory" class="org.apache.logging.pinpoint.analyser.DefaultAnalyzerFactory"
/>
   
+  <bean id="messageListener" class="org.apache.logging.pinpoint.jms.BufferedLoggingEventJMSMessageListener">
+  	<constructor-arg ref="eventWriterloggingEventHandler" />
+  </bean>
+
   
-  <bean id="pinpointAppender" class="org.apache.logging.pinpoint.converter.PinpointAppender"
init-method="activateOptions">
-  	<constructor-arg ref="rootLogger" />
+  <bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
+    <property name="connectionFactory" ref="jmsFactory" />
+    <property name="destination" ref="destination" />
+  	<property name="messageListener" ref="messageListener" />
+  </bean>
+  
+  <bean id="eventWriterloggingEventHandler" class="org.apache.logging.pinpoint.converter.PinpointEventWriterHandler">
   	<constructor-arg ref="contextSelector" />
   	<constructor-arg ref="indexWriterFactory" />
   	<constructor-arg ref="analyserFactory" />
   </bean>
   
+  <bean id="loggingEventHandler" class="org.apache.logging.pinpoint.jms.BufferedJMSLoggingEventHandler">
+ 	<constructor-arg ref="jmsTemplate" />
+  </bean>
+  
+  <bean id="pinpointAppender" class="org.apache.logging.pinpoint.converter.PinpointAppender"
init-method="activateOptions">
+  	<constructor-arg ref="rootLogger" />
+  	<constructor-arg ref="loggingEventHandler" />
+  </bean>
  </beans>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message