Signal to a user from a java action

0
Hello, Currently I am writing a java-action that connects to a phone-system. When a call is received the user has to be informed about the call. What I have tried so far is to execute a workflow that should show the incoming calldata in a page. The workflow is executed but the page is not displayed. After some research I found the Misc.executeMicroflowAsUser. The result is the same. The workflow is executed but the page is not displayed. Is this expected behaviour or am I doing something wrong? If I am not doing something wrong is there another way to get the incoming call to the user?
asked
3 answers
3

Hello,

After some research I discovered the call "Core.execute(getContext(), etc) has to be done inside the java-action. It can not be done from a method in an Innerclass or a method inside the class implementing the java action.

Once the java action is done no pages are shown when the microwflow is called.

Next to this the pages are only shown after the javaaction is finished. Calling the microflow n-times gives n-pages only after the java action is finished.

Liked to share this with you.

answered
1

I believe you miss the connection between the users browser and the Mendix runtime.

Try adding a watcher widget to the users page that is loaded in the global context and watches for updates from the server by calling a microflow in a set interval. That way you should be able to get the wanted connection. You could also try to create a push system where the clients subscribe to your Mendix runtime and the Mendix runtime sends push notifications to the browser.

You could either use an external provider like Iron.IO to connect the browser and the Mendix runtime or Java libraries some possible solutions are listed in the following blogpost: http://www.sitepoint.com/message-queues-comparing-beanstalkd-ironmq-amazon-sqs/

answered
0

This is expected behavior: running a microflow as a user is different from running a microflow using a user's current context. I believe the following might work:

private void updateSessionOfUser(IUser user) {
    String userName = user.getName();
    for (ISession session : Core.getActiveSessions()) {
        if (session.getUser().getName().equals(userName)) {
            Core.execute(session.getContext(), microflowName, params)
answered