Eventqueue EventListener not fired

asked 2013-07-01 09:45:47 +0800

aros54 gravatar image aros54

Hi all. I am getting across an issue I'm not able to figure out how it can happen. From a (custom) component onClick event I am creating a EventQueue in order to publish a Event other pages can listen to. After the event publishing I send a redirect to another page. This is the code:

    private EventListener eventListener = new EventListener() {
    public void onEvent(Event event) throws Exception {
        if (Events.ON_CLICK.equals(event.getName())) {
    public void doProcess() {
      EventQueue eq = 
        EventQueues.lookup("createInnerWindowQueue", EventQueues.SESSION, true);
      eq.publish(new Event("createInnerWindow", this));

On the new page (page.zul) there is a Div component which has a Composer like this:

public class DivComposer implements Composer<Div> {
private EventQueue eq = EventQueues.lookup("createInnerWindowQueue", EventQueues.SESSION, false);
public void doAfterCompose(final Div comp) throws Exception {
    if (eq != null) {
        eq.subscribe(new EventListener() {
            public void onEvent(Event event) throws Exception {
                // here the code to process the event
        }, true);


I tried both syncronous and asyncronous events. The subscribe statement is always executed, however the onEvent method is never fired. This code seems to me in line with the samples on reference manuals. What am I missing?


delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-01 14:25:00 +0800

gekkio gravatar image gekkio flag of Finland
899 1

You are first publishing an event, and then adding a subscriber. That doesn't work because there is no-one listening when the event is published, so it is simply discarded.

The EventQueue only publishes events to current subscribers, and it doesn't store them if nobody is listening. That is how publish-subscribe -style queues work in general.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-07-01 09:45:47 +0800

Seen: 12 times

Last updated: Jul 01 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More