EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Infobus events: are they ever "consumed"?

  • 1.  Infobus events: are they ever "consumed"?

    Posted Fri January 15, 2016 02:10 PM

    Greetings to all.

    I am developing a pilot project using Infobus and started to notice some strange behaviour.  It was after installing RBD 9.5.0.1, but it may have been happening in 9.1.1 and I didn't notice (can't downgrade).  Here's the situation:

    RUI handler A publishes an event, and activates RUI widget B, which subscribes to the event and gets it.  Then B finishes its work and returns to A.  The second time around B then receives two events; the third time, three events and so on.  The event data corresponds to the last event published.

    Is there something that I need to do for B to receive just the most recent event?

    Thanks in advance.

    Regards,

    F. Alejandro Osso

    Alejandro Osso


  • 2.  Re: Infobus events: are they ever "consumed"?

    Posted Sat January 16, 2016 06:25 AM

    Hi Alejandro,

    It depends on how handler A activates widget B.

    Do you instantiate a new widget B-object every time? Do you unsubscribe previous infobus subscriptions?

    Can you provide an example to have a closer look?

    Regards,

    Guus

     

    gweis


  • 3.  Re: Infobus events: are they ever "consumed"?

    Posted Sun January 17, 2016 11:03 AM

    Hi Guus,

    I reuse both A and B widget objects; there is a "main" handler (sorry I didn't mention before) which holds them and does the actual widget switching**.  I do the unsubcriptions in each widget just before it is about to relinquish control to the other.

    I got intrigued by your questions, so I experimented changing the logic.  First to unsubscribe earlier, within the event-receiving function, but this did not make a difference.  Then to instantiate a new B every time, and this worked; which --besides a big "thanks Guus!"-- triggered some other questions.  Why doesn't A suffer the same?  Is it relevant whether the event is published by a function in a library?  What is the lifecycle of InfoBus events; aren't they "cleared" when there are no remaining subscriptions to it? does it make a difference whether they have been acknowledged or not?

    I will try to set up a project with the minimum logic in which the behavior could be reproduced and append it.

     

    Once again thanks for your reply.

    Regards,

    Alejandro.

     

    **I took the idea from this article: https://iseriesegl.wordpress.com/2012/07/22/a-multi-page-richui-web-architecture-using-egl/ and --quite effortlessly-- put it to work in RBD EGL.

    Alejandro Osso


  • 4.  Re: Infobus events: are they ever "consumed"?

    Posted Tue January 19, 2016 03:47 AM

    Hi Alejandro,

     

    You should know that InfoBus subscriptions remain intact until you unsubscribe.

    Even when you destroy a widget who's InfoBus subscriptions have not been unsubscribed, will it keep responding to the messages it subscribed to. In fact the widget is not really destroyed because there are still InfoBus subscriptions inside it. The latter also causes memory issues.

    When you reuse widgets containing InfoBus subscriptions you should only subscribe the widget once to certain InfoBus messages. Since your widget is responding multiple times to the same InfoBus message I would expect your widget B adds a InfoBus subscription every time widget A activates it.

     

    So, some answers to your questions:

    A subscription does not automatically clear when there are no remaining subscriptions.

    It doesn't matter whether you publish an InfoBus message in a library function or not.

    If you would like to elaborate you will have to attach your sample project.

     

    Kind regards,

    Guus

    gweis


  • 5.  Re: Infobus events: are they ever "consumed"?

    Posted Wed January 20, 2016 02:03 PM

    Hi Guus,

    Right on the spot: I was subscribing multiple times.

    Thank you so much for your help.  Not only solved the specific problem, you also provided explanations about Infobus which the docs wouldn´t.

     

    Best regards,

    Alejandro.

     

    Alejandro Osso