adding gateway-based echo sample, to be refactored into unit tests later
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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:amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:console="http://www.springframework.org/schema/integration/stream" xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
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.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- From STDIN To RabbitMQ -->
|
||||
|
||||
<console:stdin-channel-adapter id="outboundGatewayRequests">
|
||||
<poller fixed-delay="1000" max-messages-per-poll="1" />
|
||||
</console:stdin-channel-adapter>
|
||||
|
||||
<amqp:outbound-gateway request-channel="outboundGatewayRequests"
|
||||
reply-channel="outboundGatewayReplies"
|
||||
routing-key="si.test.gateway.echo"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<!-- From RabbitMQ To STDOUT -->
|
||||
|
||||
<amqp:inbound-gateway request-channel="inboundGatewayRequests" queue-names="si.test.gateway.echo" connection-factory="connectionFactory" />
|
||||
|
||||
<transformer input-channel="inboundGatewayRequests" expression="payload.toString().toUpperCase()"/>
|
||||
|
||||
<!-- <logging-channel-adapter id="outboundGatewayReplies" log-full-message="true"/> -->
|
||||
<console:stdout-channel-adapter id="outboundGatewayReplies" append-newline="true" />
|
||||
|
||||
<!-- Infrastructure -->
|
||||
|
||||
<rabbit:connection-factory id="connectionFactory"/>
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory"/>
|
||||
|
||||
<rabbit:admin connection-factory="connectionFactory"/>
|
||||
|
||||
<rabbit:queue name="si.test.gateway.echo"/>
|
||||
|
||||
</beans:beans>
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.amqp.config;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @since 2.1
|
||||
*/
|
||||
public class GatewayEchoTests {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ClassPathXmlApplicationContext("GatewayEchoTests-context.xml", GatewayEchoTests.class);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user