<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/aop
		http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.1.xsd">
	
	<context:mbean-export />
	
	<bean id="messageServiceBreaker"
		class="com.springinpractice.ch14.kite.guard.CircuitBreakerTemplate"
		p:exceptionThreshold="4"
		p:timeout="30000" />
	
	<bean id="messageServiceGuardListAdvice" class="com.springinpractice.ch14.kite.interceptor.GuardListInterceptor">
		<property name="source">
			<bean class="com.springinpractice.ch14.kite.interceptor.DefaultGuardListSource">
				<property name="guards">
					<list>
						<ref bean="messageServiceBreaker" />
					</list>
				</property>
			</bean>
		</property>
	</bean>
	
	<!-- Use AOP to guard message service calls -->
	<aop:config>
		<aop:pointcut id="messageServicePointcut"
			expression="execution(* com.springinpractice.ch14.kite.sample.service.impl.MessageServiceImpl.*(..))" />
		<aop:advisor advice-ref="messageServiceGuardListAdvice" pointcut-ref="messageServicePointcut" />
	</aop:config>
</beans>
