https://github.com/georgeosddev/glokka-demo
Demo project for Clustering Xitrum- Servers with Glokka.
https://github.com/georgeosddev/glokka-demo
Last synced: 2 months ago
JSON representation
Demo project for Clustering Xitrum- Servers with Glokka.
- Host: GitHub
- URL: https://github.com/georgeosddev/glokka-demo
- Owner: georgeOsdDev
- Created: 2014-08-06T10:17:22.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T10:17:32.000Z (about 5 years ago)
- Last Synced: 2025-01-20T19:33:53.932Z (4 months ago)
- Language: Scala
- Homepage: http://george-osd-blog.heroku.com/48
- Size: 1.12 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Glokka Demo
===========This is a demo project for
Clustering `Xitrum `_- Servers with `Glokka `_.::
+--------------------+ +--------------------+
| Xitrum | | Xitrum |
| +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ |
| | Glokka | |
| | _ _ _ [ Hub Actor ] _ _ _ | |
| | / \ | |
| +~~~~~~~~~~/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\~~~~~~~~~~+ |
| / | | \ |
| [HubClientActor] | | [HubClientActor] |
| | | | | |
+---------|----------+ +----------|---------+
| |
+------------|------------+ +------------|------------+
| Browser | | Browser |
| | | |
| var sock = SockJS | | var sock = SockJS |
| (http://localhost:8000) | | (http://localhost:8001) |
| | | |
+-------------------------+ +-------------------------+How Hub Actor works
~~~~~~~~~~~~~~~~~~~* ``Subscribe(option:Map[String, Any])``
Join to HUB as subscriber. ``Done(option:Map[String, Any])`` message will be return from HUB.
::
[HubClientActor] - Subscribe -> [Hub Actor]
|
|
<--- Done --------」* ``Unsubscribe(option:Map[String, Any])``
Leave from HUB, ``Done(option:Map[String, Any])`` message will be return from HUB.
::
[HubClientActor] - Unubscribe -> [Hub Actor]
|
|
<--- Done --------」* ``Push(option:Map[String, Any])``
Send message to HUB, HUB will handle that request then ``Publish(option:Map[String, Any])`` to all subscriber except sender.
::
[HubClientActor] - Push -> [Hub Actor] ---- Publish ---> [(another) HubClient Actor]
| \
| ---- Publish ---> [(another) HubClient Actor]
<--- Done ---」 \
--- Publish ---> [(another) HubClient Actor]* ``Pull(option:Map[String, Any])``
Send command to HUB, HUB will handle that request(eg: count subscriber num) then response result to sender as ``Done(option:Map[String, Any])`` message.
::
[HubClientActor] - Pull -> [Hub Actor]
|
|
<--- Done ----」How to Run
==========Clone and compile project
::
cd /path/to/temp/directory
git clone https://github.com/georgeosddev/glokka-demo
cd glokka-demo
sbt/sbt xitrum-packageCopy packaged application 2 times
::
cd ../
cp -r glokka-demo/target/xitrum node1
cp -r glokka-demo/target/xitrum node2Edit config for node2 to include "akka_for2" and "xitrum_for2"
::
cd node2
vi config/application.confRun 2 application from separate terminal
node1 will listen http://localhost:8000、and node2 will listen http://localhost:8001.::
cd /path/to/temp/directory/node1
./script/runner glokka.demo.Boot::
cd /path/to/temp/directory/node2
./script/runner glokka.demo.Boot