Skip to content

Frontend core and Mediator #20

@rogergros

Description

@rogergros

Hi, We found a problem when using Mediator on Frontendcore.

We tried to subscribe two different modules to the same topic and found that only the first subscription worked.

We deeply looked at the code of FrontendCore and Tinycore Mediator and found that the way Frontendcore uses Tinycore is not the way it's expected to work. Tinycore expects that every time that a Mediator is called the "nSubscriberId" value is increased on the object construction. Mediator uses that subscriber id to check if someone has already been subscribed to the topic. And in this case simply ignores the subscription (Considers that's already subscribed).

Frontendcore only creates the Mediator once and always provides the same instance, that way the second time that a different module asks to get subscribed to a topic gets the same instance of Mediator and the subscription is ignored.

Some changes could be done to fix that:

  • Frontendcore should always create a new instance of Mediator every time increasing the nSubscriberId
  • Tinycore mediator should probably autoincrement a property on the mediator construction and not rely on the library bridge, anyway frontendcore should create a new instance any time that's required.

PS: We found that Tinycore already increments that property when loading the Mediator trough toolbox so you should only call the Tinycore toolbox everytime than a Mediator is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions