Simply execute the bootstrap.sh
script to download and install all the
necessary dependencies including:
- Apache Karaf 3.0.3
- Apache Kafka 2.10-0.8.2.0
Dependencies are downloaded to an opt/
directory in the project root.
mvn clean package
cp zero-downtime-soa-dependencies/target/zero-downtime-soa-dependencies.kar opt/karaf/deploy/
This step pre-installs the necessary Karaf bundles for Cellar, Camel, Hazelcast, and Kafka required by the bundles.
cp hello-service-api/target/hello-service-api.jar opt/karaf/deploy/
cp hello-service/target/hello-service.jar opt/karaf/deploy/
opt/karaf/bin/karaf
When the API bundle starts, it finds an available port on the host to bind to the Jetty server to. Check the Karaf log for which port it started on. You should see a message similar to this:
2015-04-04 19:17:22,695 | INFO | raf-3.0.3/deploy | AbstractConnector | 82 - org.eclipse.jetty.aggregate.jetty-all-server - 8.1.15.v20140411 | Started [email protected]:59953
Hint: If you can't find the port, just execute the following command from the Karaf console:
log:tail | grep rest-api
In this case, the Jetty server started on port 59953. Simply make an HTTP GET request to the API endpoint:
curl -XGET localhost:59953/rest-api/sync/John
And you should get back a personalized message.
From the Karaf console:
instance:clone root slave-0
instance:start slave-0
instance:clone root slave-1
instance:start slave-1
Cloning the root Karaf instance copies all the current configuration and deployed bundles to the slaves. It's a good way to spin up new instances in real-time to add capacity without needing to re-install everything.
cp config/karaf/org.apache.karaf.cellar.node.cfg opt/karaf/etc/
The config contained in this project enables the bundle, config, and feature listeners that are responsible for replicating changes from the root Karaf instance to the slaves:
bundle.listener = true
config.listener = true
feature.listener = true
There are helpful scripts in the root of the project to start both a basic, single node Zookeeper instance and a 2-node Kafka cluster:
./0-start-zookeeper.sh
./1-start-kafka-1.sh
./1-start-kafka-2.sh
Please note, it's important to start Zookeeper first as Kafka is heavily dependent on it.
curl -XGET localhost:59953/rest-api/async/Mary
Please refer to the Karaf site for current documentation.
Please refer to the Kafka site for current documentation.