<?xml version="1.0"?>

<beans
	default-destroy-method="destroy"
	default-init-method="afterPropertiesSet"
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop"
	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.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>

	<!-- Advice -->

	<aop:config>
		<aop:aspect ref="messagingProxyAdvice">
			<aop:around pointcut="bean(com.liferay.portal.bi.rules.RulesEngineProxyBean)" method="invoke" />
		</aop:aspect>
	</aop:config>

	<!-- Proxy -->

	<bean id="com.liferay.portal.bi.rules.RulesEngineProxyBean" class="com.liferay.portal.bi.rules.RulesEngineProxyBean">
		<property name="singleDestinationSynchronousMessageSender">
			<bean class="com.liferay.portal.kernel.messaging.sender.DefaultSingleDestinationSynchronousMessageSender">
				<property name="destinationName" value="liferay/rules_engine" />
				<property name="synchronousMessageSender" ref="com.liferay.portal.kernel.messaging.sender.DirectSynchronousMessageSender" />
			</bean>
		</property>
		<property name="singleDestinationMessageSender">
			<bean class="com.liferay.portal.kernel.messaging.sender.DefaultSingleDestinationMessageSender">
				<property name="destinationName" value="liferay/rules_engine" />
				<property name="messageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
			</bean>
		</property>
	</bean>

	<!-- Util -->

	<bean class="com.liferay.portal.kernel.bi.rules.RulesEngineUtil">
		<property name="rulesEngine" ref="com.liferay.portal.bi.rules.RulesEngineProxyBean" />
	</bean>

	<!-- Messaging -->

	<bean id="destination.rules_engine" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<property name="name" value="liferay/rules_engine" />
	</bean>
	<bean id="messagingConfigurator.rules" class="com.liferay.portal.kernel.messaging.config.DefaultMessagingConfigurator">
		<property name="destinations">
			<list>
				<ref bean="destination.rules_engine" />
			</list>
		</property>
		<property name="messageBus">
			<ref bean="com.liferay.portal.kernel.messaging.MessageBus" />
		</property>
	</bean>
</beans>