<?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:os-core="http://www.openspaces.org/schema/core"
       xmlns:os-events="http://www.openspaces.org/schema/events"
       xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
       xmlns:os-sla="http://www.openspaces.org/schema/sla"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.openspaces.org/schema/core http://www.openspaces.org/schema/core/openspaces-core.xsd
       http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
       http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd
       http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/openspaces-sla.xsd">
    
<!-- ================================================================================================================== -->
	
    <!-- Enables the usage of @GigaSpaceContext annotation based injection. -->
    <os-core:giga-space-context/>
	
    <!-- A bean representing a space (an IJSpace implementation).
         Note, we perform a lookup on the space since we are working against a remote space. -->
    <os-core:space id="space" url="jini://*/*/spacePP"/>

    <!-- OpenSpaces simplified space API built on top of IJSpace/JavaSpace. -->
    <os-core:giga-space id="gigaSpace" space="space"/>
	
	<!-- Defines a local Jini transaction manager. -->
    <os-core:local-tx-manager id="transactionManager" space="space"/>
	
    <!-- The Data feeder bean, writing new OrderEvents objects to the space in a constant interval. -->
    <bean id="orderEventFeeder" class="com.gigaspaces.examples.tutorials.parallelprocessing.client.OrderEventFeeder"/>
	
	<!-- This bean outputs the orderEvent object -->
    <bean id="outputOrderEvent" class="com.gigaspaces.examples.tutorials.parallelprocessing.client.OrderEventCounterDisplayer"/>
    
<!-- ================================================================================================================== -->
    
    <!-- The notification container, registers for notification on every orderEvent write (notify 
    	 on write is default) that satisfies the template (in this case with status="Approved").
    	 Upon notification invokes the outputOrderEvent listner on a copy of the object that 
    	 triggered the event.
    	 The notify event container is also configured to automatically perform a take on the
    	 notification data event, and configured to filter out events if the take operation returned null 
    	 (this usually happens when several clients receive this event, and only one succeeds with the take) 
    	 -->
	<os-events:notify-container id="orderEventNotifyContainer" giga-space="gigaSpace" perform-take-on-notify="true" ignore-event-on-null-take="true">
		<os-events:tx-support tx-manager="transactionManager"/>
		<os-core:template>
	        <bean class="com.gigaspaces.examples.tutorials.parallelprocessing.common.OrderEvent">
	        	<property name="status" value="Rejected"/>
	        </bean>
	    </os-core:template>
	    <os-events:listener>
	        <os-events:annotation-adapter>
	            <os-events:delegate ref="outputOrderEvent"/>
	        </os-events:annotation-adapter>
	    </os-events:listener>
	</os-events:notify-container>
	
	<!-- A polling event container that performs (by default) polling take operations against
         the space using the provided template (in this case, the processed orderEvent objects).
         Once a match is found, the outputOrderEvent bean event listener is triggered using the
         annotation adapter, the listener method is annotated inside the bean with the @SpaceDataEvent
         annotation. -->
    <os-events:polling-container id="orderEventPollingEventContainer" giga-space="gigaSpace">
        <os-events:tx-support tx-manager="transactionManager"/>
        <os-core:template>
            <bean class="com.gigaspaces.examples.tutorials.parallelprocessing.common.OrderEvent">
                <property name="status" value="Processed"/>
            </bean>
        </os-core:template>
        <os-events:listener>
            <os-events:annotation-adapter>
                <os-events:delegate ref="outputOrderEvent"/>
            </os-events:annotation-adapter>
        </os-events:listener>
    </os-events:polling-container>
	
</beans>
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence