cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF > DOSGi Discovery
Date Fri, 04 Dec 2009 16:37:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/11/_/styles/combined.css?spaceKey=CXF&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CXF/DOSGi+Discovery">DOSGi
Discovery</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~davidb@apache.org">David
Bosschaert</a>
    </h4>
     Update to 1.1
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     Update to 1.1<br />
     </div>
          <br/>
     <div class="notificationGreySide">
         <p>This page outlines setting up the Discovery implementation that is part
of CXF Distributed OSGi.</p>

<h2><a name="DOSGiDiscovery-Introduction"></a>Introduction</h2>
<p>The Distributed OSGi document RFC 119 also describes a standard way publish and obtain
remote service metadata. A primary use-cases for this is a Discovery system. How the discovery
system works is not described, but the interaction with the Discovery system is. This interaction
happens through OSGi services. </p>

<p>The CXF/DOSGi project comes with a RFC 119 compliant Discovery implementation that
uses Apache ZooKeeper as the underlying technology for the Discovery Server. This page outlines
how to get started with CXF DOSGi/Discovery.</p>

<h2><a name="DOSGiDiscovery-InstallingandruntheZooKeeperserver"></a>Installing
and run the ZooKeeper server</h2>
<p>Read the ZooKeeper Getting Started page: <a href="http://hadoop.apache.org/zookeeper/docs/current/zookeeperStarted.html"
rel="nofollow">http://hadoop.apache.org/zookeeper/docs/current/zookeeperStarted.html</a></p>

<p>The ZooKeeper distribution doesn't contain any Windows scripts yet. If you're on
<a href="https://issues.apache.org/jira/browse/ZOOKEEPER-426" rel="nofollow">Windows
you can download scripts to start the ZooKeeper server and the client program from here</a>.</p>

<p>Once you have ZooKeeper installed (the current version used is 3.2.1), run its server:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">$ bin/zkServer
... log messages ...
2009-06-10 13:23:27,288 - INFO  [main:FileTxnSnapLog@198] - Snapshotting: 0
</pre>
</div></div>
<p>The ZooKeeper server is now ready.</p>

<p>You can check that all is well by running the client program:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">$ bin/zkCli -server localhost:2181
--&gt; ls /
Processing ls
[zookeeper]</pre>
</div></div>
<p>So besides the zookeeper node, there is nothing in the ZooKeeper virtual filesystem
yet.</p>

<h2><a name="DOSGiDiscovery-InstallingtheCXFDiscoveryBundles"></a>Installing
the CXF Discovery Bundles</h2>
<p>The CXF/DOSGi Discovery implementation interacts with the ZooKeeper server. It's
included in both the Single-bundle and Multi-bundle distributions of CXF-DOSGi.</p>

<h3><a name="DOSGiDiscovery-SingleBundleDistribution"></a>Single Bundle
Distribution</h3>
<p>When you are using the CXF-DOSGi Single-Bundle distro, you automatically get the
Discovery functionality with that.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-&gt; install http:<span class="code-comment">//repo1.maven.org/maven2/org/osgi/org.osgi.compendium/4.2.0/org.osgi.compendium-4.2.0.jar
</span>Bundle ID: 4
-&gt; install http:<span class="code-comment">//www.apache.org/dist/cxf/dosgi/1.1/cxf-dosgi-ri-singlebundle-distribution-1.1.jar
</span>Bundle ID: 5
-&gt; start 5
... log messages ...
-&gt; ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] <span class="code-object">System</span> Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   4] [Resolved   ] [    1] osgi.cmpn (4.2.0.200908310645)
[   5] [Active     ] [    1] Distributed OSGi Distribution Software Single-Bundle Distribution
(1.1)</pre>
</div></div>
<p>The Discovery bundle is now active, but it doesn't do anything yet since it's not
yet configured. </p>

<h3><a name="DOSGiDiscovery-MultiBundleDistribution"></a>Multi Bundle Distribution</h3>
<p>TODO</p>

<h2><a name="DOSGiDiscovery-ConfiguringDiscovery"></a>Configuring Discovery</h2>
<p>The CXF/Discovery component is configured through the OSGi Configuration Admin Service.
For convenience the CXF/Discovery distributions come with the Configuration Admin and FileInstall
implementations from Felix, but you can also use another implementation of the Configuration
Admin service.</p>

<p>When you start up the bundle(s) in the CXF/Discovery distribution, the FileInstall
bundle will create a 'load' directory in the current working directory. This is where you
can put Config Admin configurations. </p>

<p>To configure the ZooKeeper client in CXF/Discovery the following configuration variables
apply. They need to be set on Configuration Admin PID <tt>org.apache.cxf.dosgi.discovery.zookeeper</tt>.</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Configuration property </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> zookeeper.host </td>
<td class='confluenceTd'> <em>no default</em> </td>
<td class='confluenceTd'> The host where the ZooKeeper server is running. </td>
</tr>
<tr>
<td class='confluenceTd'> zookeeper.port </td>
<td class='confluenceTd'> 2181 </td>
<td class='confluenceTd'> The port of the ZooKeeper server. </td>
</tr>
<tr>
<td class='confluenceTd'> zookeeper.timeout </td>
<td class='confluenceTd'> 3000 </td>
<td class='confluenceTd'> Sets the ZooKeeper tick time. </td>
</tr>
</tbody></table>
<p>For more information on the ZooKeeper configuration variables see the ZooKeeper administration
guide: <a href="http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html" rel="nofollow">http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html</a></p>

<p>An easy way to set the configuration, it by placing a file called <tt>org.apache.cxf.dosgi.discovery.zookeeper.cfg</tt>
in the load directory created by the FileInstall bundle with the following content:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
zookeeper.host = 127.0.0.1
</pre>
</div></div>
<p>As soon as you set the configuration, the Discovery will connect to the ZooKeeper
server. You will see a few log messages on the ZooKeeper server console to reflect this.</p>

<p>You can always check the configuration of the ZooKeeper client by looking at the
ManagedService registered by the CXF/Discovery bundle:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">-&gt; services 6

Distributed OSGi Zookeeper-Based Discovery Single-Bundle Distribution (6) provides:
-----------------------------------------------------------------------------------
... other services ...
----
objectClass = org.osgi.service.cm.ManagedService
felix.fileinstall.filename = org.apache.cxf.dosgi.discovery.zookeeper.cfg
service.id = 38
service.pid = org.apache.cxf.dosgi.discovery.zookeeper
zookeeper.host = localhost
zookeeper.port = 2181
zookeeper.timeout = 3000
</pre>
</div></div>

<p>For further information and a walkthrough of the Discovery demo see the <a href="/confluence/display/CXF/DOSGi+Discovery+Demo+page"
title="DOSGi Discovery Demo page">DOSGi Discovery Demo page</a>.</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CXF/DOSGi+Discovery">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=119937&revisedVersion=10&originalVersion=9">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CXF/DOSGi+Discovery?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message