Repository: karaf-cellar Updated Branches: refs/heads/master d3cb8edd5 -> d527e4c0b
Update the samples README with Karaf/Cellar 3 instructions Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/d527e4c0 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/d527e4c0 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/d527e4c0 Branch: refs/heads/master Commit: d527e4c0ba7123a92e80ccf3419007de615e5942 Parents: d3cb8ed Author: Jean-Baptiste Onofré <[email protected]> Authored: Mon Jun 23 21:25:03 2014 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Mon Jun 23 21:25:03 2014 +0200 ---------------------------------------------------------------------- samples/camel-hazelcast-app/README | 43 +++++++++++++++ .../resources/OSGI-INF/blueprint/blueprint.xml | 2 +- samples/dosgi-greeter/README | 57 ++++++++++---------- samples/dosgi-greeter/pom.xml | 49 ----------------- .../src/main/resources/features.xml | 29 ---------- samples/hazelcast-app/README | 3 +- 6 files changed, 75 insertions(+), 108 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/camel-hazelcast-app/README ---------------------------------------------------------------------- diff --git a/samples/camel-hazelcast-app/README b/samples/camel-hazelcast-app/README new file mode 100644 index 0000000..cdbe940 --- /dev/null +++ b/samples/camel-hazelcast-app/README @@ -0,0 +1,43 @@ +Camel Hazelcast App is a sample application that demonstrate the usage of the camel-hazelcast component with Cellar +to provide remote communication between Camel routes. + +Use Case +-------- +The producer bundle periodically (every 5 seconds) create a message "Hello Cellar" and send it into the distributed +Hazelcast/Cellar queue "yet.another.queue". +On the other hand, the consumer bundle consumes the messages from the "yet.another.queue" Hazelcast queue and display +the message body in the log file + +Installation +------------ +To show the remote Camel routes communication, your Cellar cluster should contain at least two nodes. + +NodeA +----- +On NodeA, we install the Camel blueprint and hazelcast features: + +karaf@root()> feature:repo-add camel +karaf@root()> feature:install camel-blueprint +karaf@root()> feature:install camel-hazelcast + +We can now install the producer bundle: + +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.camel.hazelcast/producer/3.0.0 + +The Camel producer route starts automatically. + +NodeB +----- +As for NodeA, we install the Camel blueprint and hazelcast features on NodeB: + +karaf@root()> feature:repo-add camel +karaf@root()> feature:install camel-blueprint +karaf@root()> feature:install camel-hazelcast + +We can now install the consumer bundle: + +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.camel.hazelcast/consumer/3.0.0 + +The Camel consumer route starts automatically. + +On the NodeB log, using log:tail, we can see the messages "coming" from NodeA. http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml index b49e36a..11807d3 100644 --- a/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -27,7 +27,7 @@ <route id="timerToLog"> <from uri="timer:foo?period=5000"/> <setBody> - <constant>Hallo Cellar</constant> + <constant>Hello Cellar</constant> </setBody> <to uri="hazelcast:seda:yet.another.queue"/> </route> http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/dosgi-greeter/README ---------------------------------------------------------------------- diff --git a/samples/dosgi-greeter/README b/samples/dosgi-greeter/README index a9d4d83..24dbc80 100644 --- a/samples/dosgi-greeter/README +++ b/samples/dosgi-greeter/README @@ -1,34 +1,35 @@ DOSGi Greeter is a sample application that demonstrates the DOSGi feature of Cellar. -Requirements / Setup --------------------- -It requires a cellar cluster of at least two nodes, say node A and B. +Use Case +-------- +A service bundle expose an OSGi service on the cluster using Cellar DOSGi. +On the other hand, a client bundle provides a shell command to call the service bundle. +The call is remote using DOSGi. -Node B will export the Greeter service and node A will import the service. +Installation +------------- +To show the remote service call, your Cellar cluster should contain at least two nodes. -192.168.1.101:5701 (Node A) -192.168.1.101:5702 (Node B) +NodeA +----- +On NodeA, we install the API bundle (providing the OSGi service description), and the service bundle (providing the +actual service implementation): -Installation ------------- -1. Start the two nodes. -2. Connect to the shell of node A. - - Node A Shell: - ------------- - karaf@root> feature:add-url mvn:org.apache.karaf.cellar.samples/dosgi-greeter/3.0.0-SNAPSHOT/xml/features - karaf@root> cluster:group-set greeter-exporter-group 192.168.1.1:5702 - Node Group - * 192.168.1.101:5701 greeter-exporter-group - 192.168.1.101:5702 greeter-exporter-group - karaf@root> cluster:group-set greeter-importer-group 192.168.1.1:5701 - Node Group - * 192.168.1.101:5701 greeter-importer-group - karaf@root> cluster:feature-install greeter-exporter-group greeter-service - karaf@root> cluster:feature-install greeter-importer-group greeter-client - -3. Executing the greet (Pass a greet message and the number of iterations). - karaf@root> dosgi-greeter:greet Halo 2 - Hello.Hello from node 192.168.1.101:5702 count 0. - Hello.Hello from node 192.168.1.101:5702 count 1. +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/3.0.0 +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.service/3.0.0 + +We can see the service exposed on the cluster using the cluster:service-list command. + +NodeB +----- +On NodeB, we install the API bundle (to get the description of the OSGi service), and the client bundle (providing a shell +command to call the service): + +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/3.0.0 +karaf@root()> bundle:install -s mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.client/3.0.0 + +The client bundle provides a new shell command that we can use to call the OSGi service (remotely): +karaf@root> dosgi-greeter:greet Hello 2 +Hello.Hello from node 192.168.1.101:5702 count 0. +Hello.Hello from node 192.168.1.101:5702 count 1. http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/dosgi-greeter/pom.xml ---------------------------------------------------------------------- diff --git a/samples/dosgi-greeter/pom.xml b/samples/dosgi-greeter/pom.xml index b7fc2c0..862c933 100644 --- a/samples/dosgi-greeter/pom.xml +++ b/samples/dosgi-greeter/pom.xml @@ -39,53 +39,4 @@ <module>client</module> </modules> - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <id>filter</id> - <phase>generate-resources</phase> - <goals> - <goal>resources</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>attach-artifact</id> - <phase>package</phase> - <goals> - <goal>attach-artifact</goal> - </goals> - <configuration> - <artifacts> - <artifact> - <file>target/classes/features.xml</file> - <type>xml</type> - <classifier>features</classifier> - </artifact> - </artifacts> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/dosgi-greeter/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/samples/dosgi-greeter/src/main/resources/features.xml b/samples/dosgi-greeter/src/main/resources/features.xml deleted file mode 100644 index 0ba439c..0000000 --- a/samples/dosgi-greeter/src/main/resources/features.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<features name="dosgi-greeter" xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"> - - <feature name='greeter-client' description='Greeter Service Client' version='${project.version}' resolver='(obr)'> - <bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/${project.version}</bundle> - <bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.client/${project.version}</bundle> - </feature> - - <feature name='greeter-service' description='Greeter Service Service' version='${project.version}' resolver='(obr)'> - <bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/${project.version}</bundle> - <bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.service/${project.version}</bundle> - </feature> - -</features> - http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/d527e4c0/samples/hazelcast-app/README ---------------------------------------------------------------------- diff --git a/samples/hazelcast-app/README b/samples/hazelcast-app/README index 48dfa86..3bd84a7 100644 --- a/samples/hazelcast-app/README +++ b/samples/hazelcast-app/README @@ -1,3 +1,4 @@ This sample intends to demonstrate how to use the HazelcastInstance created by Cellar. -Mostly it intends to point out that currently Hazelcast requires the user to set the Thread Context ClassLoader, in order to be able to serialize/deserialize user created objects. +Mostly it intends to point out that currently Hazelcast requires the user to set the Thread Context ClassLoader, +in order to be able to serialize/deserialize user created objects.
