Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Polling container takes only once

  1. I write an entry Foo to the space.

  2. I have dumbed down a SimplePollingEventListenerContainer to take any Foo entries out of the space whenever written and invoke my listener.

  3. My listener wraps the Foo in a different POJO (Wrapper) and writes that object to the space with a lease duration of 30 seconds.

  4. I have a SimpleNotifyEventListenerContainer that listens for lease expirations on Wrapper when the time elapses. The container notifies my listener.

  5. My listener unwraps Foo and writes it back to the space.

  6. At this time I would like to say that the process should repeat with step #2 above, but it does not.

The polling container does not recognize that Foo has been written back to the space. I have also tried using a notification container with take option instead of the polling container, but still no luck.

Any ideas?

Edited by: James Cook on Sep 5, 2008 9:52 PM

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2570]{quote}

asked 2008-09-05 21:51:33 -0500

oravecz gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Do u see at the space stats (GS-UI space view tab) that a write operation been performed with step 4?

Can u post your pu.xml and the Foo and Wrapper classes?

Shay

answered 2008-09-05 22:24:49 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

The write takes place in step #5 as witnessed by the gui.

I'll try to simplify my code so I can post more, but for now here are the two containers from the pu.xml file:

<bean id="orderSubmitedContainer"
      class="org.openspaces.events.polling.SimplePollingEventListenerContainer"
      p:gigaSpace-ref="gigaspace">

    <property name="template">
        <bean class="com.mydomain.order.OrderWorkflow" p:status="SUBMITTED"/>
    </property>

    <property name="eventListener">
        <bean class="org.openspaces.events.config.MethodEventAdapterFactoryBean"
              p:delegate-ref="authorizeAction"
              p:methodName="execute"/>
    </property>
</bean>


<!--
This container will listen for lease expiration events on the OrderWorkflowSleeper. This class exists for
a relatively short period of time and is solely a means of putting an order "to sleep" to simulate a
processing delay. One use of this is during credit card processing. If there is a communication failure to
the processor, this class wraps the OrderWorkflow and is written to the space for a set period of time.
When the commFailureAction class is executed, the OrderWorkflow is back in play.
-->
<bean id="orderSleeperContainer"
      class="org.openspaces.events.notify.SimpleNotifyEventListenerContainer"
      p:notifyLeaseExpire="true"
      p:gigaSpace-ref="gigaspace">

    <property name="template">
        <bean class="com.mydomain.order.OrderWorkflowSleeper"/>
    </property>

    <property name="eventListener">
        <bean class="org.openspaces.events.config.MethodEventAdapterFactoryBean"
              p:delegate-ref="commFailureAction"
              p:methodName="execute"/>
    </property>
</bean>
oravecz gravatar image oravecz  ( 2008-09-06 00:27:24 -0500 )edit

I figured out my problem. I had an int primitive in my Entry class and I was incrementing this value in my listener. Subsequent templates would not match because the int field was non-null. Argh.

oravecz gravatar image oravecz  ( 2008-09-06 00:51:58 -0500 )edit

To avoid using the null-value decoration have the field type as Integer instead and have its initial value as null. This will make sure the template created will match every space Object. Shay

shay hassidim gravatar image shay hassidim  ( 2008-09-06 06:37:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-09-05 21:51:33 -0500

Seen: 54 times

Last updated: Sep 05 '08