This project contains the material of the demos presented for the talk Getting Social Media Projects with Apache Camel and covering different topics relevant for the business, architect or developer users.
-
Get your feets with Social Component and push your data to the browser - demo1
-
Collect Metrics/Statistics store them and query result - demo2
-
Design your own dashboard/plugin to report information for the business - demo3
-
Provision your java container using profiles and fabric
Note
|
These demos let you to discover some of the Business Activity Monitoring Feature(s) proposed by the JBoss Fuse product and the opensource projects part of that technology : Apache Camel, ElasticSearch, kibana3, fabric8, Insight, hawtio |
The code of the project must be downloaded and installed locally on your machine. This process will be achieved by using the
git clone
command.
-
Open a Terminal and move to a directory
-
Clone the project
git clone https://github.com/cmoulliard/devnation-2014-camel.git
-
Move to the directory
demo
cd demo
-
Compile the project using maven
mvn clean install
When we have compiled the project and deployed the artifacts into our local maven repository, we will install JBoss Fuse 6.1.x
and
configure it
-
Unzip the file downloaded
jboss-fuse-full-6.1.0.redhat-378.zip
Warning
|
The last digit number 378 of the JBoss Fuse release distribution file will change when the GA release of JBoss Fuse 6.1 will be officially announced. |
-
Move to the directory created
jboss-fuse-6.1.0.redhat-378
cd jboss-fuse-6.1.0.redhat-378
In order to allow the web clients to access to the Fuse Management Console
, it is required to uncomment the line where the user admin
is defined into
the file users.properties
-
Edit the file etc/users.properties to uncomment the line containing #admin=admin,admin
-
Move to the bin directory
cd bin
-
Start
fuse
server./fuse or fuse.bat
Next we will turn on our Fuse Platform into a Fuse Fabric server to facilitate the deployment and the configuration of the different java containers that we will use to play with the demos. When the Fabric server is created a Zookeeper server is installed locally in your Fuse server which is used to maintain like a DNS, LDAP registry the configurations of the Fuse instances, services deployed, the profiles containing the definitions of the modules (camel, cxf, activemq, …) that we can use to provision our instances.
-
To install the fabric server, run the following command :
fabric:create
Important
|
As Fabric is not installed by default with the JBoss Fuse or JBoss AMQ distribution, this additional step is required. |
-
Open your browser at the following address
http://localhost:8181/index.html
and check that a root container is up and running. The cloud icon displayed after the root container with the version number 1.0 means that a Zookeeper server has been deployed and that a default profile versioned as 1.0 has been provisioned under the root container. By default, the fuse and fabric profiles are installed and will let our container to manage the integration stuffs like also the fabric to create new containers, provision them, virtualize the endpoints (camel, cxf, activemq, …), …
-
Now that the Fuse fabric is working, we will deploy the artefacts (bundles, configuration files, parameters) required into the registry to play with the demos. This step has been simplified by Fabric as we can create what is called a profile and assign such information. From that point of view, a profile is nothing more than an envelope containing this following kinds of information:
-
The URL locations of the Feature(s) repositories (= XML file)
-
A list of Feature(s) to install (= corresponds to a module definition and contains artefacts to be deployed, config file, parameters)
-
A list of bundles to install (or, more generally, any suitable JAR package—including OSGi bundles, Fuse Application Bundles, and WAR files)
-
A collection of configuration settings for the OSGi Config Admin service
-
Java system properties that affect the Apache Karaf container (analogous to editing etc/config.properties)
-
Java system properties that affect installed bundles (analogous to editing etc/system.properties)
-
For the purpose of this project and the demos we have created 3 different profiles which correspond to a different use case and can be used to setup a different scenario :
-
Twitter / demonstrate camel twitter like also insight/elasticsearch feature and push data to websocket client
-
MBean / expose JMX MBean twitter services for the camel route, dashboard and plugin
-
Plugin / hawtio plugin designed for business users to handle their data
The description of the different profiles is defined here after :
Profile Name |
Description |
Parent profile(s) : feature-camel insight-core Feature(s) : camel-websocket camel-twitter Bundle(s) : mvn:org.devnation.demo/camel-twitter/1.0-SNAPSHOT Configuration details : PID: twitter |
|
Plugin |
Parent profile(s) : hawtio Bundle(s) : mvn:org.devnation.demo/social-plugin/1.0-SNAPSHOT |
Mbean |
Parent profile(s) : feature-camel Feature(s) : camel Bundle(s) : mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.twitter4j/3.0.5_1 mvn:com.google.code.gson/gson/2.2.4 mvn:org.devnation.demo/mbean/1.0-SNAPSHOT Configuration details : PID: twitter |
This process to create into the fabric registry the profiles with their corresponding artefacts will be achieved when the Fabric server has been started
and when you will run this maven command under the demo
directory
mvn fabric8:deploy -Dfabric8.upload=false
The plugin will use the resources (classes, properties, xml files, …) created under the target directory like also what has been defined under the src/fabric8 directory to package the bundle, create the profile module definition and push it to the fabric server.
Note
|
More information about the maven plugin fabric8:deploy can be find here
like also how to configure it, define the parameters and use it.
|
The information published can be retrieved from the Fabric registry using this command executed within the Karaf console :
fabric:profile-display demo-social-twitter fabric:profile-display demo-social-plugin fabric:profile-display demo-social-mbean
OR using the Fuse Management Console
. Then, you must navigate using your browser to the following addresses :
http://localhost:8181/hawtio/index.html#/wiki/branch/1.0/view/fabric/profiles/demo/social/mbean.profile?cv=1.0 http://localhost:8181/hawtio/index.html#/wiki/branch/1.0/view/fabric/profiles/demo/social/plugin.profile?cv=1.0 http://localhost:8181/hawtio/index.html#/wiki/branch/1.0/view/fabric/profiles/demo/social/twitter.profile?cv=1.0
When we deploy the profiles into the Fuse Registry, they are also been published into a local GIT repository.
Note
|
This GIT repository has been added to JBoss Fuse 6.1 to allow not only to upload initial profiles definitions from the folder ($JBOSS_FUSE_HOME/fabric/import/fabric/configs/versions/1.0)
to the registry but to let also the user to maintain the information as a tree structure under the source code management system using the hawtio wiki , commit
changes or revert them
|
During this demo, we will demonstrate how we can use one of the Camel social component (twitter), configure it, retrieve data and push them to your browser.
Now, that we have been able to collect data/tweets from Twitter, it is important to store the information using Fuse Insight storage to let next the business users to query the data (Collect Metrics/Statistics store them and query result )
In some situations, the business users would be interested that we put in place a dashboard to consult directly the relevant data/information. Design your own dashboard/plugin to report information for the business
rm -rf ../instances/ rm -rf ../data/elastic rm -rf ../data/zookeeper ./karaf clean
-
console * fabric:create --clean -m 127.0.0.1 -r localhostname
-
Maven project ** mvn fabric8:deploy -Dfabric8.upload=false
-
console * fabric:container-add-profile root insight-kibana fabric:container-create-child --profile demo-social-twitter root demo
-
fabric:container-stop demo fabric:container-delete demo
-
Patch **
et modifier le profile pour ajouter:
override.insigt-camel=mvn:org.fusesource.insight/insight-camel/1.0.0.redhat-999-devnation;range=[1.0,1.1)
cp /Users/chmoulli/MyProjects/conferences/devnation-2014/demo/camel-twitter/insight-camel-1.0.0.redhat-999-devnation.jar /Users/chmoulli/Fuse/Fuse-servers/jboss-fuse-6.1.0.redhat-376/system/org/fusesource/insight/insight-camel/1.0.0.redhat-999-devnation/ mkdir -p /Users/chmoulli/Fuse/Fuse-servers/jboss-fuse-6.1.0.redhat-376/system/org/fusesource/insight/insight-camel/1.0.0.redhat-999-devnation