<?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"
	xmlns:cloud="http://schema.cloudfoundry.org/spring"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
			https://www.springframework.org/schema/beans/spring-beans.xsd
			http://schema.cloudfoundry.org/spring
			https://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
			http://www.springframework.org/schema/integration
			https://www.springframework.org/schema/integration/spring-integration.xsd
			http://www.springframework.org/schema/integration/amqp
			https://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
			http://www.springframework.org/schema/rabbit
			https://www.springframework.org/schema/rabbit/spring-rabbit.xsd
			http://www.springframework.org/schema/integration/stream
			https://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">


	<!-- rabbit connection factory, rabbit template, and rabbit admin -->
	<import resource="classpath:META-INF/spring/integration/amqp/cafeDemo-amqp-config-xml.xml" />

	<!-- To receive an AMQP Message from a Queue, and respond to its reply-to address, configure an inbound-gateway. -->
	<int-amqp:inbound-gateway
		id="coldDrinksBarista"
		request-channel="coldJsonDrinks"
		queue-names="cold-drinks"
		connection-factory="rabbitConnectionFactory" />

	<int:chain input-channel="coldJsonDrinks">
		<int:json-to-object-transformer type="org.springframework.integration.samples.cafe.OrderItem"/>
		<int:service-activator method="prepareColdDrink">
			<bean class="org.springframework.integration.samples.cafe.xml.Barista"/>
		</int:service-activator>
		<int:object-to-json-transformer content-type="text/x-json"/>
	</int:chain>

	<!-- rabbit exchanges, queues, and bindings used by this app -->
	<rabbit:topic-exchange name="cafe-drinks" auto-delete="true" durable="true">
		<rabbit:bindings>
			<rabbit:binding queue="cold-drinks" pattern="drink.cold"/>
			<rabbit:binding queue="all-cold-drinks" pattern="drink.cold"/>
		</rabbit:bindings>
	</rabbit:topic-exchange>

	<rabbit:queue name="cold-drinks" auto-delete="true" durable="true"/>
	<rabbit:queue name="all-cold-drinks" auto-delete="true" durable="true"/>

</beans>
