INT-1380 added jms sample
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
||||
1
getting-started/jms/.gitignore
vendored
Normal file
1
getting-started/jms/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
@@ -1,9 +0,0 @@
|
||||
Instructions for running the HelloWorldDemo sample
|
||||
-------------------------------------------------------------------------------
|
||||
1. See README.txt in the parent directory.
|
||||
|
||||
This demo consists of two samples, ChannelAdapterDemo and GatewayDemo.
|
||||
PLease see the corresponding javadocs for more details on each sample.
|
||||
|
||||
|
||||
Happy integration :-)
|
||||
BIN
getting-started/jms/activemq-data/localhost/journal/data-1
Normal file
BIN
getting-started/jms/activemq-data/localhost/journal/data-1
Normal file
Binary file not shown.
BIN
getting-started/jms/activemq-data/localhost/journal/data-control
Normal file
BIN
getting-started/jms/activemq-data/localhost/journal/data-control
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
getting-started/jms/activemq-data/localhost/lock
Normal file
0
getting-started/jms/activemq-data/localhost/lock
Normal file
@@ -2,43 +2,45 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>spring-integration-samples</artifactId>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>jms</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>Spring Integration JMS Sample</name>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<spring.integration.version>2.0.0.M7</spring.integration.version>
|
||||
<activemq.version>5.2.0</activemq.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-core</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>${activemq.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-jms</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-stream</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repository.springframework.maven.release</id>
|
||||
<name>Spring Framework Maven Release Repository</name>
|
||||
<url>http://maven.springframework.org/release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>repository.springframework.maven.milestone</id>
|
||||
<name>Spring Framework Maven Milestone Repository</name>
|
||||
<url>http://maven.springframework.org/milestone</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>repository.springframework.maven.snapshot</id>
|
||||
<name>Spring Framework Maven Snapshot Repository</name>
|
||||
<url>http://maven.springframework.org/snapshot</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
16
getting-started/jms/readme.txt
Normal file
16
getting-started/jms/readme.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
This example demonstrates the following aspects of the JMS support available with Spring Integration:
|
||||
1. JMS Message-driven Channel Adapter
|
||||
2. JMS Inbound Gateway
|
||||
3. JMS Outbound Gateway
|
||||
|
||||
as well as Poller and stdout and stdin Channel Adapters (from Stream support) which will allow you to interact with JMS via the console.
|
||||
It uses ActiveMQ embedded broker
|
||||
|
||||
To run samples simply execute GatewayDemo and ChannelAdapterDemo classes located in the org.springframework.integration.samples.jms package
|
||||
|
||||
When running demos you will see the following prompt:
|
||||
> Please type something and hit return
|
||||
|
||||
GatewayDemo uses DemoBean service which will echo the response upper-casing it
|
||||
|
||||
ChannelAdapterDemo will simply echo the response
|
||||
@@ -27,7 +27,6 @@ public class DemoBean {
|
||||
|
||||
@ServiceActivator
|
||||
public String upperCase(String input) {
|
||||
return input.toUpperCase();
|
||||
return "JMS response: " + input.toUpperCase();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,13 +32,16 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
public class ChannelAdapterDemo {
|
||||
|
||||
private final static String[] configFiles = {
|
||||
"common.xml", "inboundChannelAdapter.xml", "outboundChannelAdapter.xml"
|
||||
"/META-INF/spring/integration/common.xml",
|
||||
"/META-INF/spring/integration/inboundChannelAdapter.xml",
|
||||
"/META-INF/spring/integration/outboundChannelAdapter.xml"
|
||||
};
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
ActiveMqTestUtils.prepare();
|
||||
new ClassPathXmlApplicationContext(configFiles, ChannelAdapterDemo.class);
|
||||
System.out.println("Please type something and hit return");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,13 +35,15 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
public class GatewayDemo {
|
||||
|
||||
private final static String[] configFiles = {
|
||||
"common.xml", "inboundGateway.xml", "outboundGateway.xml"
|
||||
"/META-INF/spring/integration/common.xml",
|
||||
"/META-INF/spring/integration/inboundGateway.xml",
|
||||
"/META-INF/spring/integration/outboundGateway.xml"
|
||||
};
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
ActiveMqTestUtils.prepare();
|
||||
new ClassPathXmlApplicationContext(configFiles, GatewayDemo.class);
|
||||
System.out.println("Please type something and hit return");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,8 @@
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="warn" />
|
||||
<logger name="org.springframework.integration.samples">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.jms">
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.jms">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.apache.activemq">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<property name="targetConnectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="sessionCacheSize" value="10"/>
|
||||
<property name="cacheProducers" value="false"/>
|
||||
</bean>
|
||||
|
||||
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="queue.demo"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="queue.reply"/>
|
||||
</bean>
|
||||
|
||||
<integration:poller id="poller" default="true" fixed-delay="1000"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
<jms:message-driven-channel-adapter id="jmsin"
|
||||
destination="requestQueue"
|
||||
channel="jmsinToStdoutChannel"/>
|
||||
|
||||
<channel id="jmsinToStdoutChannel"/>
|
||||
|
||||
<stream:stdout-channel-adapter id="stdout" channel="jmsinToStdoutChannel" append-newline="true"/>
|
||||
|
||||
</beans:beans>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
<context:component-scan base-package="org.springframework.integration.samples.jms"/>
|
||||
|
||||
<jms:inbound-gateway id="jmsin"
|
||||
request-destination="requestQueue"
|
||||
request-channel="demoChannel"/>
|
||||
|
||||
<channel id="demoChannel"/>
|
||||
|
||||
<service-activator input-channel="demoChannel" ref="demoBean"/>
|
||||
|
||||
</beans:beans>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
<stream:stdin-channel-adapter id="stdin" channel="stdinToJmsoutChannel"/>
|
||||
|
||||
<channel id="stdinToJmsoutChannel"/>
|
||||
|
||||
<jms:outbound-channel-adapter id="jmsout" channel="stdinToJmsoutChannel" destination="requestQueue"/>
|
||||
|
||||
</beans:beans>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
<stream:stdin-channel-adapter id="stdin" channel="stdinToJmsoutChannel"/>
|
||||
|
||||
<channel id="stdinToJmsoutChannel"/>
|
||||
|
||||
<jms:outbound-gateway request-channel="stdinToJmsoutChannel"
|
||||
request-destination="requestQueue"
|
||||
reply-channel="jmsReplyToStdoutChannel"/>
|
||||
|
||||
<channel id="jmsReplyToStdoutChannel"/>
|
||||
|
||||
<stream:stdout-channel-adapter channel="jmsReplyToStdoutChannel" append-newline="true"/>
|
||||
|
||||
</beans:beans>
|
||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
#Generated by Maven
|
||||
#Sat Sep 04 08:22:08 EDT 2010
|
||||
version=2.0.0.BUILD-SNAPSHOT
|
||||
groupId=org.springframework.integration.samples
|
||||
artifactId=jms
|
||||
Reference in New Issue
Block a user