<?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">
<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"/>
<os-core:giga-space id="gigaSpace" space="space"/>
<os-core:local-tx-manager id="transactionManager" space="space"/>
<bean id="orderEventFeeder" class="com.gigaspaces.examples.tutorials.parallelprocessing.client.OrderEventFeeder"/>
<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>