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

Ask Your Question

Notify Container

I am writing a notify listener operation.

GigaSpace gigaSpace = // either create the GigaSpace or get it by injection

SimpleNotifyEventListenerContainer notifyEventListenerContainer = new SimpleNotifyContainerConfigurer(gigaSpace) .template(new Data(false)) .eventListenerAnnotation(new Object() { @SpaceDataEvent public void eventHappened() { eventCalled.set(true); } }).notifyContainer();

Do I need a listener for this operation? Or while a write operation is done in the space, the method eventHappened() will get called? Please let me know how the notify container works. h4. Attachments


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

asked 2009-09-18 06:23:18 -0600

abhilash428 gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

Yes, your method will be called when the event occurs.

Eitan h4. Attachments


answered 2009-09-18 07:15:23 -0600

eitany gravatar image
edit flag offensive delete link more



event() is not getting called after GridEntry is written to space.

Code is attached. Please tell me is it the right way to register notify event and listen for events. Do I require a listener also?


Abhilash h4. Attachments


abhilash428 gravatar imageabhilash428 ( 2009-09-18 07:34:47 -0600 )edit

The following works for me (I'm using the fifoSupport @SpaceClass annotation property comes with 7.0.1 - you can use the fifo with previous versions):

The space class: {code} import com.gigaspaces.annotation.pojo.FifoSupport; import com.gigaspaces.annotation.pojo.SpaceClass; import com.gigaspaces.annotation.pojo.SpaceId; import com.gigaspaces.annotation.pojo.SpaceProperty; import com.gigaspaces.annotation.pojo.SpaceRouting;

@SpaceClass (fifoSupport=FifoSupport.ALL) public class MyMessage {

private String id;
private String destinationName;

public MyMessage() {

@SpaceId(autoGenerate = false)
public String getId() {
    return id;

public void setId(String id) {
    this.id = id;

@SpaceProperty(index = SpaceProperty.IndexType.BASIC)
public String getDestinationName() {
    return destinationName;

public void setDestinationName(String destinationName) {
    this.destinationName = destinationName;



The application class (I'm starting both the space and accessing it via remote proxy from the same process for the sake of the test only: {code} import org.openspaces.core.GigaSpace; import org.openspaces.core.GigaSpaceConfigurer; import org.openspaces.core.space.UrlSpaceConfigurer;

import org.openspaces.events.adapter.SpaceDataEvent; import org.openspaces.events.notify.SimpleNotifyContainerConfigurer; import org.openspaces.events.notify.SimpleNotifyEventListenerContainer;

public class NotifyConMain {

public static void main(String[] args) {

    GigaSpace gigaEmbed = new GigaSpaceConfigurer(new UrlSpaceConfigurer("/./nsefeedspace")).gigaSpace();
    GigaSpace gigaRemote= new GigaSpaceConfigurer(new UrlSpaceConfigurer("jini://*/*/nsefeedspace")).gigaSpace();

    SimpleNotifyEventListenerContainer notifyEventListenerContainer = new SimpleNotifyContainerConfigurer(
            gigaRemote).template(new MyMessage()).eventListenerAnnotation(
            new Object() {
                public void event(MyMessage event) {
                    System.out.println("GOT EVENT >>>>>>>>>>>>>>>>> - Object ID:" + event.getId());
                    try {
                    } catch (Exception e) {

for (int i=0;i<10;i++)
    MyMessage o = new MyMessage();
    o.setDestinationName("Des"+ i);

} } {code}

shay hassidim gravatar imageshay hassidim ( 2009-09-18 12:56:02 -0600 )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


Asked: 2009-09-18 06:23:18 -0600

Seen: 211 times

Last updated: Sep 18 '09