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

	<amqp:outbound-channel-adapter id="rabbitOutbound" exchange-name="outboundchanneladapter.test.1">
		<amqp:request-handler-advice-chain>
			<bean class="org.springframework.integration.amqp.config.AmqpOutboundChannelAdapterParserTests$FooAdvice" />
		</amqp:request-handler-advice-chain>
	</amqp:outbound-channel-adapter>

	<rabbit:template id="amqpTemplate" connection-factory="connectionFactory"/>

	<bean id="connectionFactory" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.amqp.rabbit.connection.ConnectionFactory" type="java.lang.Class"/>
	</bean>

	<amqp:outbound-channel-adapter id="withHeaderMapperCustomHeaders" channel="requestChannel"
								   exchange-name="outboundchanneladapter.test.1"
								   default-delivery-mode="NON_PERSISTENT"
								   lazy-connect="false"
								   delay-expression="42"
								   mapped-request-headers="foo*"/>

	<bean id="customHeaderMapper" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.integration.amqp.support.AmqpHeaderMapper" type="java.lang.Class"/>
	</bean>

	<amqp:outbound-channel-adapter id="withCustomHeaderMapper"
								   exchange-name="test.exchange"
								   headers-last="true"
								   header-mapper="customHeaderMapper"/>

	<int:channel id="requestChannel"/>

	<int:chain id="chainWithRabbitOutbound" input-channel="amqpOutboundChannelAdapterWithinChain">
		<amqp:outbound-channel-adapter exchange-name="outboundchanneladapter.test.1"/>
	</int:chain>

	<rabbit:template id="amqpTemplateConfirms" connection-factory="connectionFactory"/>

	<amqp:outbound-channel-adapter id="withPublisherConfirms" channel="pcRequestChannel"
								   exchange-name="outboundchanneladapter.test.1"
								   mapped-request-headers="foo*"
								   auto-startup="false"
								   amqp-template="amqpTemplateConfirms"
								   confirm-correlation-expression="headers['amqp_confirmCorrelationData']"
								   confirm-ack-channel="ackChannel"
								   error-message-strategy="ems"/>

	<rabbit:template id="amqpTemplateConfirms2" connection-factory="connectionFactory"/>

	<amqp:outbound-channel-adapter id="withPublisherConfirms2" channel="pcRequestChannel"
								   exchange-name="outboundchanneladapter.test.1"
								   mapped-request-headers="foo*"
								   auto-startup="false"
								   amqp-template="amqpTemplateConfirms2"
								   confirm-correlation-expression="headers['amqp_confirmCorrelationData']"
								   confirm-ack-channel="ackChannel"
								   confirm-nack-channel="nackChannel"
								   confirm-timeout="2000"
								   wait-for-confirm="true"
								   error-message-strategy="ems"/>

	<bean id="ems" class="org.springframework.integration.support.DefaultErrorMessageStrategy" />

	<int:channel id="pcRequestChannel"/>

	<int:channel id="ackChannel">
		<int:queue/>
	</int:channel>

	<int:channel id="nackChannel">
		<int:queue/>
	</int:channel>

	<amqp:outbound-channel-adapter id="withDefaultAmqpTemplateExchangeAndRoutingKey"/>

	<rabbit:template id="amqpTemplateWithSuppliedExchangeAndRoutingKey" connection-factory="connectionFactory"
			exchange="default.test.exchange" routing-key="default.routing.key"/>

	<amqp:outbound-channel-adapter id="toRabbitOnlyWithTemplateChannel" amqp-template="amqpTemplateWithSuppliedExchangeAndRoutingKey"/>

	<amqp:outbound-channel-adapter id="overrideTemplateAttributesToEmpty" amqp-template="amqpTemplateWithSuppliedExchangeAndRoutingKey"
		exchange-name="" routing-key=""/>

</beans>
