INTSAMPLES-30 - initial commit of the AMQP Sample
Added .DS_Store to .gitignore Removed the image as it is problematic with Github. Will be added to the SI AMQP reference documentation instead Removed a ":" from the readme Removed a class that was not used anymore polishing
This commit is contained in:
committed by
Mark Fisher
parent
d87f141e83
commit
a24994dc1c
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.
|
||||
* 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.springframework.integration.samples.amqp;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* Starts the Spring Context and will initialize the Spring Integration message flow.
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public final class Main {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
|
||||
|
||||
private Main() { }
|
||||
|
||||
/**
|
||||
* Load the Spring Integration Application Context
|
||||
*
|
||||
* @param args - command line arguments
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
|
||||
LOGGER.info("\n========================================================="
|
||||
+ "\n "
|
||||
+ "\n Welcome to Spring Integration! "
|
||||
+ "\n "
|
||||
+ "\n For more information please visit: "
|
||||
+ "\n http://www.springsource.org/spring-integration "
|
||||
+ "\n "
|
||||
+ "\n=========================================================" );
|
||||
|
||||
final AbstractApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml");
|
||||
|
||||
context.registerShutdownHook();
|
||||
|
||||
LOGGER.info("\n========================================================="
|
||||
+ "\n "
|
||||
+ "\n This is the AMQP Sample - "
|
||||
+ "\n "
|
||||
+ "\n Please enter some text and press return. The entered "
|
||||
+ "\n Message will be sent to the configured RabbitMQ Queue,"
|
||||
+ "\n then again immediately retrieved from the Message "
|
||||
+ "\n Broker and ultimately printed to the command line. "
|
||||
+ "\n "
|
||||
+ "\n=========================================================" );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.
|
||||
* 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.springframework.integration.service;
|
||||
|
||||
/**
|
||||
* Provides string manipulation services.
|
||||
*/
|
||||
public interface StringConversionService {
|
||||
|
||||
/**
|
||||
* Converts a String to Upper Case.
|
||||
*
|
||||
* @param stringToConvert The string to convert to upper case
|
||||
* @return The converted upper case string.
|
||||
*/
|
||||
String convertToUpperCase(String stringToConvert);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
|
||||
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- From STDIN To RabbitMQ -->
|
||||
|
||||
<int-stream:stdin-channel-adapter id="consoleIn" channel="toRabbit" >
|
||||
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
|
||||
</int-stream:stdin-channel-adapter>
|
||||
|
||||
<int:channel id="toRabbit" />
|
||||
|
||||
<!-- From RabbitMQ To STDOUT -->
|
||||
|
||||
<int-amqp:inbound-channel-adapter channel="fromRabbit"
|
||||
queue-names="si.test.queue"
|
||||
connection-factory="connectionFactory" />
|
||||
|
||||
<int:channel id="fromRabbit">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="loggingChannel"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int-stream:stdout-channel-adapter id="consoleOut" channel="fromRabbit" append-newline="true"/>
|
||||
|
||||
<int:logging-channel-adapter id="loggingChannel" log-full-message="true" level="INFO"/>
|
||||
|
||||
<!-- Infrastructure -->
|
||||
|
||||
<rabbit:connection-factory id="connectionFactory" />
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:admin connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:queue name="si.test.queue" />
|
||||
|
||||
<rabbit:direct-exchange name="si.test.exchange">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:direct-exchange>
|
||||
|
||||
</beans>
|
||||
24
basic/amqp/src/main/resources/logback.xml
Normal file
24
basic/amqp/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.integration.samples.amqp">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<root>
|
||||
<level value="INFO" />
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user