Webinar End State
The state of the project at the end of the webinar, use git log -p <this commit> to see what changed.
This commit is contained in:
committed by
Gunnar Hillert
parent
dbd1be3579
commit
e2dc83b725
@@ -60,6 +60,7 @@ This category targets developers who are already more familiar with the Spring I
|
||||
* **rest-http** - This sample demonstrates how to send an HTTP request to a Spring Integration's HTTP service while utilizing Spring Integration's new HTTP Path usage. This sample also uses Spring Security for HTTP Basic authentication. With HTTP Path facility, the client program can send requests with URL Variables.
|
||||
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
|
||||
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
|
||||
* **monitoring** The project used in the *[Spring Integration Management and Monitoring Webinar](http://www.springsource.org/node/3598)* Also available on the *[SpringSourceDev YouTube Channel](http://www.youtube.com/SpringSourceDev)*
|
||||
|
||||
## Advanced
|
||||
|
||||
|
||||
@@ -3,7 +3,25 @@ Spring Integration - Monitoring
|
||||
|
||||
This application demonstrates managing and monitoring Spring Integration Applications.
|
||||
|
||||
It was used in the webinar here TBD.
|
||||
It is based on the STS 'Spring Integration Project (war)' template project, available using
|
||||
|
||||
New... | Spring Template Project
|
||||
|
||||
It was used in the "Managing and Monitoring Spring Integration" webinar available
|
||||
on the SpringSource Developer YouTube Channel http://www.youtube.com/SpringSourceDev
|
||||
|
||||
If you wish to see the changes made during the webinar, please use the following git command:
|
||||
|
||||
git log -p <The commit titled 'Webinar End State'>
|
||||
|
||||
|
||||
To run the sample, in STS, use Run As... | Run on Server
|
||||
|
||||
and then use VisualVM/JConsole to explore the MBeans.
|
||||
|
||||
The twitter search results can be examined at http://localhost:8080/monitoring
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
For help please see the Spring Integration documentation:
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.M2</spring.integration.version>
|
||||
<spring.integration.version>2.2.0.M3</spring.integration.version>
|
||||
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
|
||||
@@ -44,6 +44,9 @@ public interface TwitterService {
|
||||
*/
|
||||
void stopTwitterAdapter();
|
||||
|
||||
/**
|
||||
* Performs an orderly shutdown of the Spring Integration twitter application.
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package _org.springframework.integration;
|
||||
package org.springintegration;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -27,6 +27,9 @@ import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
/**
|
||||
* A sample channel interceptor that illustrates a technique to capture elapsed times
|
||||
* based on message payload types.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 2.2
|
||||
*
|
||||
@@ -38,6 +41,11 @@ public class PayloadAwareTimingInterceptor extends ChannelInterceptorAdapter {
|
||||
|
||||
private Map<Class<?>, Stats> statsMap = new ConcurrentHashMap<Class<?>, PayloadAwareTimingInterceptor.Stats>();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param classes An array of types for which statistics will be captured; if
|
||||
* not supplied {@link Object} will be added as a catch-all.
|
||||
*/
|
||||
public PayloadAwareTimingInterceptor(Class<?>[] classes) {
|
||||
for (Class<?> clazz : classes) {
|
||||
this.statsMap.put(clazz, new Stats());
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package _org.springframework.integration.service.impl;
|
||||
package org.springintegration.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -25,21 +25,20 @@ import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.model.TwitterMessage;
|
||||
import org.springframework.integration.monitor.IntegrationMBeanExporter;
|
||||
import org.springframework.integration.service.TwitterService;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.jmx.export.annotation.ManagedMetric;
|
||||
import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
import org.springframework.social.twitter.api.Tweet;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Implementation of the TwitterService interface.
|
||||
* In the _org package because SI excludes all org.springframework.integration.*
|
||||
* In the org.springintegration package because SI excludes all org.springframework.integration.*
|
||||
* classes from MBean export.
|
||||
*/
|
||||
@Service
|
||||
|
||||
@ManagedResource
|
||||
public class DefaultTwitterService implements TwitterService {
|
||||
|
||||
/** Holds a collection of polled Twitter messages */
|
||||
@@ -12,22 +12,54 @@
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration/twitter http://www.springframework.org/schema/integration/twitter/spring-integration-twitter.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
|
||||
<bean id="mbeanServer"
|
||||
class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
|
||||
|
||||
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application"/>
|
||||
<context:mbean-export default-domain="spring.application"/>
|
||||
|
||||
<int:message-history/>
|
||||
|
||||
<context:component-scan base-package="org.springframework.integration.service" />
|
||||
|
||||
<int-twitter:search-inbound-channel-adapter id="twitter" query="#springintegration"
|
||||
channel="twitterChannel" auto-startup="true">
|
||||
<int:poller fixed-rate="30000" max-messages-per-poll="10" />
|
||||
</int-twitter:search-inbound-channel-adapter>
|
||||
|
||||
<int:service-activator id="twitterServiceActivator" input-channel="twitterChannel"
|
||||
|
||||
<int:inbound-channel-adapter id="dummyAdapter" channel="twitterChannel" method="getTweet">
|
||||
<bean class="org.springframework.integration.service.impl.DummyTwitter"/>
|
||||
<int:poller fixed-delay="5000"/>
|
||||
</int:inbound-channel-adapter>
|
||||
|
||||
<int:header-enricher id="addFooHeader" input-channel="twitterChannel" output-channel="twitterChannel2">
|
||||
<int:correlation-id value="foo"/>
|
||||
</int:header-enricher>
|
||||
|
||||
<int:transformer id="noopButSlowTransformer" input-channel="twitterChannel2" output-channel="twitterChannel3">
|
||||
<int-groovy:script>
|
||||
Thread.sleep(1000)
|
||||
payload
|
||||
</int-groovy:script>
|
||||
</int:transformer>
|
||||
|
||||
<int:service-activator id="twitterServiceActivator" input-channel="twitterChannel3"
|
||||
ref="twitterService" method="addTwitterMessages" />
|
||||
|
||||
<bean id="twitterService" class="_org.springframework.integration.service.impl.DefaultTwitterService"/>
|
||||
<bean id="twitterService" class="org.springintegration.service.impl.DefaultTwitterService"/>
|
||||
|
||||
<int:channel id="twitterChannel">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger" />
|
||||
<bean class="org.springintegration.PayloadAwareTimingInterceptor">
|
||||
<constructor-arg>
|
||||
<array>
|
||||
<value>java.lang.String</value>
|
||||
<value>org.springframework.social.twitter.api.Tweet</value>
|
||||
</array>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
Class-Path:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,20 +16,19 @@
|
||||
|
||||
package org.springframework.integration;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* Run this class to run the sample from the command line.
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class SpringIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSpringIntegrationContextStartup() throws Exception{
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
final ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml", SpringIntegrationTest.class);
|
||||
new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml", SpringIntegrationTest.class);
|
||||
System.out.println("Hit Enter to terminate");
|
||||
System.in.read();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user