ReplicatedSpace - 10 years later
/by apr/
10 years ago I add an experimental ReplicatedSpace implementation to the jPOS-EE project. While it was fun to develop and test, it didn't get too much traction (or so I thought).
It turned out that I've started to hear about several high-end production systems using it, so I migrated it from the old GoogleCode repo to the new Github one.
Want to give it a quick try? Here are the very simple instructions:
Clone de jPOS-Template into a test directory
git clone https://github.com/jpos/jPOS-template.git rspace && cd rspace
Edit build.gradle
Add the dependency compile "org.jpos.ee:jposee-rspace:2.0.9-SNAPSHOT"
, your dependencies will look like this:
dependencies {
compile ('org.jpos:jpos:2.0.+') {
exclude(module: 'junit')
exclude(module: 'hamcrest-core')
}
testCompile 'junit:junit:4.8.2'
compile "org.jpos.ee:jposee-rspace:2.0.9-SNAPSHOT"
}
Install resources
Call gradle installResources
This will extract the ReplicatedSpace configuration from its jar and will place it in your src/dist
directory
Remove the file src/dist/deploy/01_multi_instance_prevention.xml
so that you can run multiple instances on the same machine
Build a distribution
gradle dist
This will create a build/distributions/rspace-2.0.0.tar.gz
that you can extract in several boxes. For a quick local run, you can gradle installApp
and cd build/install/rspace
to have the same effect.
Run the system
Call bin/q2
and you'll see something like this:
<log realm="org.jpos.space.ReplicatedSpaceAdaptor" at="Thu Jun 04 15:18:17.406 UYT 2015" lifespan="1ms">
<info>
view-accepted
[apr-19136|0] (1) [apr-19136]
</info>
</log>
If you run it again, or in a different box in the same LAN, you'll see several view-accepted
messages.
At this point, you can create a little script to perform some space operations, i.e:
import org.jpos.space.*;
Space sp = SpaceFactory.getSpace("rspace:rspace");
sp.out ("TEST", "REPLICATED MESSAGE");
A nice way to run a script is to deploy something like this:
Add a file called say 90_script.xml
to your deploy directory:
<script> server(6666); </script>
Then telnet localhost 6667
(please note the server says '6666' but you connect to 6666+1, this is BeanShell stuff.
At the bsh%
prompt, you can type your space operations.