[go: up one dir, main page]

Menu

Tree [bd93ce] v0.6.3 / samples / hello /
 History

HTTPS access


File Date Author Commit
 src 2015-10-09 Sperry, Daniel Sperry, Daniel [a16740] Migrating to Infinispan 8.0.1.Final
 README.md 2015-05-14 joe@bioware.com joe@bioware.com [599aec] Preparing for IActor rename
 pom.xml 2016-01-08 Joe Hegarty Joe Hegarty [bd93ce] Version 0.6.3
 start-multiple.bat 2015-04-05 Daniel Sperry Daniel Sperry [5f9d26] Moving the hello example to orbit/samples

Read Me

Hello World Sample

public interface Hello extends Actor
{
    Task<String> sayHello(String greeting);
}

public class HelloActor extends AbstractActor implements Hello
{
    public Task<String> sayHello(String greeting)
    {
        getLogger().info("Received: " + greeting);
        return Task.fromValue("You said: '" + greeting + "', I say: Hello from " + runtimeIdentity() + " !");
    }
}

Hello helloActor = Actor.getReference(Hello.class, "0");
helloActor.sayHello("Hello!").join();

Building

mvn clean install

Running

Run multiple concurrent nodes to see that only one has
the Hello Actor active.

Type a message in the command line and find which node
has the actor.

Windows

Start multiple nodes with:

start-multiple.bat

Stop the nodes with ctrl+d

Linux

Start each node with:

mvn exec:java

Stop the nodes with ctrl+z

Sample Output

-------------------------------------------------------------------
GMS: address=helloWorldCluster, cluster=ISPN, physical address=192.168.0.10:52155
-------------------------------------------------------------------
You said: 'Hi from Orbit[1jue6LU5Q/uwXebNT8YQ7A]', I say: Hello from Orbit[lUrbzZw0Squmn5Ox3kTK3w] !

Type a message and press enter, or run other instances and see what happens.
-->hello orbit!
You said: 'hello orbit!', I say: Hello from Orbit[lUrbzZw0Squmn5Ox3kTK3w] !
-->_