Giter Site home page Giter Site logo

akka-examples's Introduction

These examples are purely meant to illustrate the posibilities of Akka. We tried to make these examples as simple as possible. The disadvantage was that we had to use some less nice constructions. If you want some more real life examples and best practices than we advice you to look at the official Akka examples.


Some of the things we did in these examples, but what you should not do:
  • Don't use Strings directly to send messages between actors, use objects.
  • Don't duplicate code, use shared projects like the messageprotocol project.
  • Don't use println, use log statements.

In general
  • Most applications can be started with 'sbt run'.
  • Do not forget to change ports, ip addresses etc.

'Simple' cluster examples

The other examples I created were a bit complicated and used for demos on a Raspberry Pi cluster. I made some simpler examples, the name of the directorie ends with simple. Running them is easy as well:

  • Use 'sbt assembly' to build both ends of the cluster. So build the 'user' project and the normal project (without 'user' in the directory name).
  • Start as many instances of the normal project as you want using 'java -jar [jarfile].jar [portnumber]'. Replacing '[jarfile] with the name of the jar and replacing '[portnumber]' with a different port for every application that you start.
  • Start the user application with ''java -jar [jarfile].jar'
  • [OPTIONAL] you can stop one of the 'non-user' applications and see that the cluster keeps running. If you stop the singleton node than you can see that another node will continue as the singleton.

Remote actors messageprotol

This is used to store the messages used by 'Remote actors coordinator' and 'Remote actors worker' to prevent code duplication. To use this project simple publish it in the local repo with the command 'sbt publishLocal'


Some examples are meant to run on one machine. Other examples are meant to run on multiple machines. We're working on making the examples support both options.

Akka cluster with routing and other examples that you want to deploy

Create fat jar with the command 'sbt assembly'. Start the fat jar with the command 'java -jar *.jar'. For the cluster start the fat jar with the command 'java -jar *.jar [IP_ADDRESS]', please enter the IP address of the machine on which the application is running.

akka-examples's People

Contributors

jiminhsieh avatar martinkanters avatar johanjanssen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.