gautamaino / gwteventservice

Automatically exported from code.google.com/p/gwteventservice
Other
0 stars 0 forks source link

addEventUserSpecific doesn't work #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. After a session has been established call the addEventUserSpecific on
the server side.
2. The client is never notified that of the user specific event.

What is the expected output? What do you see instead?

Client should be notified in the apply(Event) callback

What version of the product are you using? On what operating system?

1.0.2

Please provide any additional information below.

Method onNotify in DefaultRemoteEventService does nothing if a domain isn't
registered for the incoming event. For user specifi events the domain is
null and the message simply discarded.

Code snippet below highlights the issue (I added the else-clause with a
comment)

public void onNotify(List<DomainEvent> anEvents) {
            for(DomainEvent theDomainEvent : anEvents) {
                //all listeners for the domain of the event will be executed
                List<RemoteEventListener> theListeners =
myDomainListenerMapping.get(theDomainEvent.getDomain());
                if(theListeners != null) {
                    final Event theEvent = theDomainEvent.getEvent();
                    for(RemoteEventListener theListener: theListeners) {
                        theListener.apply(theEvent);
                    }
                } else {
                //user specific event or no listener specified for the
message domain 

                }
            }
        }

Original issue reported on code.google.com by magnus.o...@gmail.com on 19 Oct 2009 at 7:27

GoogleCodeExporter commented 8 years ago
but how the user should be informed, when he hasn´t registered any listener?

the only issue I see, is that the user-specific events are not well documented. 
you
just have to add a listener for the 'null' domain:

RemoteEventServiceFactory.getInstance().getRemoteEventService().addListener(null
, new
RemoteEventListener() {
  public void apply(Event anEvent) {
    // all user-specific events
  }
});

Original comment by dem...@googlemail.com on 22 Oct 2009 at 4:22

GoogleCodeExporter commented 8 years ago
Ah, that explains it - no bug then. I agree it could be better documented ;)

I ended up hacking my own solution - basically a
addUserSpecificListener(RemoteListener) method allowing me to register for 
those events.

Thanks for the reply anyways.

Original comment by magnus.o...@gmail.com on 22 Oct 2009 at 6:34

GoogleCodeExporter commented 8 years ago
Puh, I thought that is an extreme critical bug since version 1.0.2 at the first
moment. ;-) Thanks.

Yes, it should be better documented. Originally user-specific events were 
introduced
to send events only to defined users of the domain. The Null-Domain is fully
supported since version 1.0.2 and should be definitely better documented. The 
next
step is to introduce a new method like addUserSpecificListener as suggested 
before.
Thanks! :-)

Original comment by sven.strohschein@googlemail.com on 23 Oct 2009 at 4:59

GoogleCodeExporter commented 8 years ago
The documentation of the NULL-/user-specific domain was improved in the trunk 
version (1.2).

Original comment by sven.strohschein@googlemail.com on 29 Jan 2011 at 2:18