Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Zoodiscovery"
Line 60: | Line 60: | ||
} | } | ||
− | Automatically publishing your | + | Automatically publishing your services is as easy as adding this property: "discovery.publish.auto=true". |
− | ===I want to get notified about discovered | + | ===I want to get notified about discovered services=== |
=Advanced configuration= | =Advanced configuration= | ||
− | + | ==ZooDiscovery Flavors== | |
− | ===Fine tuning the underlying ZooKeeper | + | ===Standalone mode: discovery.flavor.standalone=== |
− | + | being edited... | |
+ | ===Centralized mode: discovery.flavor.centralized=== | ||
+ | being edited... | ||
+ | ===Replicated mode: discovery.flavor.replicated=== | ||
+ | being edited... | ||
+ | ==Fine tuning the underlying ZooKeeper== | ||
+ | being edited... | ||
=Recipes= | =Recipes= | ||
− | ===Automate R-OSGi | + | ===Automate proxying discovered services using R-OSGi and ZooDiscovery=== |
+ | being edited... |
Revision as of 10:49, 22 March 2010
Contents
What is ZooDiscovery?
ZooDiscovery is a discovery mechanism that runs as an OSGi service. It leverage Apache ZooKeeper robustness and implements Eclipse ECF Discovery API.(Hence the name!). ZooDiscovery is flexible and easy to configure.
Download
The concept in some words
ZooDiscovery implements both ECF discovery interfaces: IDiscoveryAdvertiser and IDiscoveryLocator. That is, ZooDiscovery can publish our services and gets us noticed about discovered services. Perfect! But how?
A ZooDiscovery instance running at your machine does its job by exchanging data with other ZooDiscovery instance(s) running elsewhere. So each running ZooDiscovety service must know where that other "elsewhere" exactly is. This is why we should first make our ZooDiscovery happy, giving it an IP address to play with.
To keep it smooth, let's take it step by step following these cases:
Learn by asking
How to get ZooDiscovery service?
IContainer container = null; try { //"ecf.discovery.zookeeper" is the container name we want to initiate. container = ContainerFactory.getDefault().createContainer("ecf.discovery.zookeeper"); } catch(ContainerCreateException e1){ // TODO } /* Build a target id to connect to. Please replace with usable IP address(es). A comma separated list of one or more IP address is also valid. Something like: "discovery.flavor.standalone=192.1.32.10,192.1.32.11" means our ZooDiscovery instance will connect to both address 192.1.32.10 and 192.1.32.11 where other ZooDiscovery services are running. */ ID serverId = container.getConnectNamespace().createInstance( new String[] { "discovery.flavor.standalone=192.1.32.10" }); try { //we then connect to other instance of container.connect(serverId, null); } catch (ContainerConnectException e1) { // TODO } // Our provider is ready.
// To advertise services we need adapting our container this way: IDiscoveryAdvertiser discoveryAdvertiser = (IDiscoveryAdvertiser) container.getAdapter(IDiscoveryAdvertiser.class); //then we enjoy calling IDiscoveryAdvertiser contract methods
// To localize/discover services we need adapting it this way: IDiscoveryLocator discoveryLocator = (IDiscoveryLocator) container.getAdapter(IDiscoveryLocator.class); //then we enjoy calling IDiscoveryLocator contract methods
How to publish/advertise my services
I want ZooDiscovery publishing my OSGi services without me interfering
IContainer container = null; try { container = ContainerFactory.getDefault().createContainer("ecf.discovery.zookeeper"); } catch(ContainerCreateException e1){ // TODO } ID serverId = container.getConnectNamespace().createInstance( new String[] { "discovery.flavor.standalone=172.17.2.219","discovery.publish.auto=true" }); try { container.connect(serverId, null); } catch (ContainerConnectException e1) { // TODO }
Automatically publishing your services is as easy as adding this property: "discovery.publish.auto=true".
I want to get notified about discovered services
Advanced configuration
ZooDiscovery Flavors
Standalone mode: discovery.flavor.standalone
being edited...
Centralized mode: discovery.flavor.centralized
being edited...
Replicated mode: discovery.flavor.replicated
being edited...
Fine tuning the underlying ZooKeeper
being edited...
Recipes
Automate proxying discovered services using R-OSGi and ZooDiscovery
being edited...