Aka actors based BackEnd integration problem.


I’m trying to use an akka based module as a backEnd for my Vaadin application, but i’m facing some problems with the way i am trying to implement things, hopefully you can help me with that.

I’m using the projet structure of the maven achetype example for an application (3 modules)
my backend module contains an actor system and a service class that contains all relevant computation methods.

as for my UIModule it contains one UI and multiple views as well as an actor system since the backEnd actors can’t access the UI.

my problem is the following :

In one of my views containg a form, when the validation button is clicked, i send a message through the UIActor to one of the backEnd Actors, when the computations are done he sends a response back to the UIActor which then tries to show a notification. I use the acess() method since the actor would be accessing the UI from an different thread.
This unfortunaltly makes it so that the notification only show once i click the button a second time.
why is that?

here are code snippets

this is the onReceive of the UIActor

@Override public void onReceive(Object message) throws Exception { 
  if (message == "test") { 
    System.out.println("showing notification by "+currentUI);
  } else if (message instanceof MyUI) { 
    System.out.println("this is the ui actor test request forwarded");  
    currentUI = (MyUI) message;
  } else { 

and this is the testMethod in the MyUI class

public void testMethod() {
   Notification.show("Success", Notification.Type.HUMANIZED_MESSAGE);

I’d appreciate it If you could tell me what’s wrong with my approach.

Just in Case anyone needs an answer to this, i was able to make it work by enabling push, by adding @Push annotation to my UI Class.