Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent cannot receive event over network #883

Closed
gbasso opened this issue Oct 31, 2018 · 4 comments
Closed

Agent cannot receive event over network #883

gbasso opened this issue Oct 31, 2018 · 4 comments

Comments

@gbasso
Copy link

gbasso commented Oct 31, 2018

Describe the bug
Unable to connect two Agents on two different computer, even if the two SARL frameworks find the other computer.

To Reproduce
Run this code on two computers:

package network

import io.sarl.core.DefaultContextInteractions
import io.sarl.core.Initialize
import io.sarl.core.Logging

event Test

agent TestAgent {
	uses Logging, DefaultContextInteractions

	on Test {
		info("Success")
	}

	on Initialize {
		info("The agent was started.")
		emit(new Test)
	}
}

Expected behavior
When the second Agent is started "Success" should be display on the two computers.

System configuration:
-- SARL version: 0.8.4
-- SARL compiler:

    • Eclipse compiler without Maven
      -- Java JDK version (with the manufacturer name): openjdk version "1.8.0_181"
      -- Operating System:
    • Linux 64bits

Additional context
The computers are connected on a local network with all ports opened, and Hazelcast can connect the SARL frameworks.

@germandcorrea
Copy link

Excellent, I needed this feature !!!

@gallandarakhneorg
Copy link
Member

Dear @germandcorrea. This networking feature should work without configuration (because we are using Hazelcast and ZeroMQ for discovering automatically the different kernels). Nevertheless, you welcome to give your feedbacks regarding this feature. I will be happy to have them for making this feature working perfectly.

@gbasso
Copy link
Author

gbasso commented Nov 8, 2018

Dear @gallandarakhneorg, I tried a ping pong example and the communication over the network does not seem to work with guards: emit(new Pong)[ it == occurrence.source ]

To Reproduce
Run this code on two computers:

// First computer
package network

import io.sarl.core.DefaultContextInteractions
import io.sarl.core.Logging

event Ping
event Pong

agent PongAgent {
    uses DefaultContextInteractions, Logging
    on Ping {
    	info("pong")
        emit(new Pong)[ it == occurrence.source ]
    }
}
// second computer
package network

import io.sarl.core.DefaultContextInteractions
import io.sarl.core.Initialize
import io.sarl.core.Logging
import io.sarl.core.Schedules

event Ping
event Pong

agent PingAgent {
    uses DefaultContextInteractions, Logging, Schedules

    on Initialize {
        val task = task("waiting_for_partner")
        task.every(1000) [
            if (defaultSpace.participants.size > 1) {
                emit(new Ping)
                task.cancel
            }
        ]
    }

    on Pong {
        info("ping")
        emit(new Ping)[ it == occurrence.source]
    }
}

Expected behavior
The first agent should display "pong" indefinitely, the second agent should display "ping" indefinitely.

System configuration:
-- SARL version: 0.8.5
-- SARL compiler:

    • Eclipse compiler without Maven
      -- Java JDK version (with the manufacturer name): openjdk version "1.8.0_181"
      -- Operating System:
    • Linux 64bits

Additional context
The computers are connected on a local network with all ports opened, and Hazelcast can connect the SARL frameworks. If the guard [ it == occurrence.source ] is commented, the message is received.

@gallandarakhneorg
Copy link
Member

Dear @gbasso.
I have create the issue #885 for your problem because it is very specific to the support of the guards, and not any more about the event rooting mechnism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants