Service Registry (Registrar) QuickStart
The Service Registry allows you to register running Mobius services with it, so that services can discover each other. For example, it is possible to use a Service Registry from inside the Mako and GME viewers to populate their lists of running collections and model exchange services. This ability is key to Grid computing. The Service Registry is a very basic service at present, however. It will be extended and improved in the future and we will be publishing guides to integrating Mobius with more robust service registry systems, such as The Globus Toolkit. Still, for basic discovery of Mobius services, the Service Registry is a viable tool.
There are two ways to use the Service Registry. You can either use the command line tools within the Service Registry to add running Mobius services to its repository. Or you can instantiate other Mobius services, such as the GME or Mako, so that they automatically register themselves with a running Service Registry. The latter procedure would be the one most commonly used in practice, but the former might be useful in cases in which a user wanted a means for aggregating a number already running, unregistered remote Mobius services for convenient discovery.
Minimal Configuration and Starting the Service Registry
As with other Mobius services, change to the /conf directory. Edit the
<MobiusNetworkServiceDescriptor ...> and change the "hostname" as appropriate.
Also assign the registry a "serviceId" in the <serviceIdentifier ... /> tag and
put in the appropriate password for your MySQL database in the <password> tag pair.
From the /scripts directory:
./startRegistrar.bat ../conf/localhost-registrar-config.xml
Registering a Service Using Service Registry Command Line Utilities
Start a GME and a Mako. For this example, we have started them on the local machine.
Now let's register the GME and Mako:
./registerService.bat -ports TCP,3940 -host localhost -registry localhost -type MAKO ./registerService.bat -ports TCP,1111 -host localhost -registry localhost -type GME
If the Mako and GME were successfully registered. You'll see output like the following on the consoles where those services were started.
INFO - Nov 2, 2004 3:19:33 PM -- 1 Received a connection from localhost:2055 INFO - Nov 2, 2004 3:20:03 PM -- 2 Received a connection from localhost:2065 INFO - Nov 2, 2004 3:20:33 PM -- 3 Received a connection from localhost:2157
The Service Registry attempts to connect to its registered Mobius services every
30 seconds. If it fails to contact a service after a number of attempts, the service's entry is dropped from
its database. You can see a list of registered services by executing the following command
from inside of the Service Registry /scripts directory:
./getServiceList.bat -registry localhost
will display information about the services added to the Service Registry and will show the automatically
generated valid service ids which can be used to contact the services through the Service Registry.
Registering a Service Automatically When Starting a Mako or GME
In this example, we will start a Mako so that it registers itself with a running GME and Service Registry.
Start a Service Registry and a GME on any hosts.
In the Mako /conf directory, edit the
localhost-mako-gme-registrar-config.xml file.
For the Mako, you will need to edit
the
<MobiusNetworkServiceDescriptor... > and
<serviceIdentifier... > tags, changing
the "hostname" and "serviceId" values, as appropriate.
For the Service Registry,
in the <xmlDataServiceFactory> element, edit
the "serviceId" value in the <serviceRegistry... > tag and the
"value" value in the <param name="registryServiceId"... /> parameter tag.
For the GME, in the
<dataModelServiceFactory> element edit the "value" value
in the <param name="registryServiceId"... /> parameter tag
and in the <gme-client-configuration> element, edit the
<gme serviceId=... /> value.
<password> for your MySQL database.
Start your Mako with:
./startMako.bat ../conf/localhost-mako-gme-registrar-config.xml
If everything went well, you will see output like the following:
INFO - Nov 4, 2004 3:13:07 PM -- Server started on MAKO://localhost at Thu Nov 04 15:13:07 EST 2004 INFO - Nov 4, 2004 3:13:07 PM -- Listening using the protocol TCP on the host 0.0.0.0, port 3940 INFO - Nov 4, 2004 3:13:07 PM -- Setting Service Identifier to MAKO://localhost INFO - Nov 4, 2004 3:13:22 PM -- 1 Received a connection from localhost:1059 INFO - Nov 4, 2004 3:13:52 PM -- 2 Received a connection from localhost:1074Notice the two lines showing a connection to the Mako from the Service Registry, confirming that that Mako registered itself upon instantiation.
The section immediately below describes contacting running Mobius services through the Service Registry.
Using the Service Registry to Connect to Mobius Services
There will be Mobius implementations in which you will want to connect to another Mobius service or group of running services (GMEs, Makos, other Service Registries) through some means other than the default loaded handles--which take care of same service type communications. For instance, by getting a handle to a running Service Registry, a Mako (or other Mobius service) can connect automatically to other running services and populate its list of query-able collections. Or you might want to locate running GMEs on remote hosts by querying some type of Grid service registry.
As a concrete example that can be extrapolated for other implementations, let's establish a connection to a GME by communicating with the Mobius Service Registry.
Here we will use the GME View to add a handle factory and Service Registry and populate the viewer with the GMEs that are registered with the Service Registry. (Note: the procedure for doing this within both the Mako and GME viewers is being revised and simplified and will be documented fully, soon):
The procedure has to basic parts: 1) add a handle factory, and, 2) add the service. The handle factory allows for the connection to the service to be established. This is the case with connections between Mobius components and between Mobius and other sorts of Grid services.
Here we are assuming that you have at least one running GME and Service Registry (as in the above QuickStart description).
Adding a Handle Factory
- Start GME View by changing into the GME's
/scriptsdirectory and typing,./GMEview.bat - In the "Function" menu, select "Add XML Data Model Service Factory"
- In the dialog that appears, fill in both the "Factory" and "Add Parameters"
sections.
We will add two sets of parameters.
The "Is Default" checkbox would make the factory we add the default
factory for connections. We probably don't want to do this, so leave it unchecked.
- Factory
-
Name: registryFactory (the name of the handle factory we will use)
Class: org.projectmobius.client.gme.ServiceRegistryXMLDataModelServiceFactory (the class that implements the handle via a factory) - Add Parameters
-
Name: serviceRegistryFactory (the first parameter required by the Service Registry Factory)
Value: org.projectmobius.client.registrar.DefaultServiceRegistryFactory
Click "Add" to add this set of parameters, then
Name: registryServiceId (the second parameter required by the Service Registry Factory)
Value: localhost (the ID of the locally running Service Registry) Click "Add", again to add this second set of parameters
- Click "Ok" If everything goes right, you'll be presented
with a "Success" dialog window,
which you can "Ok".

You have instantiated the new factory and have added it to the list of available factories.
Adding a Registry
- In the "Function" menu, select "Add Service Registry"
- In the "Registry" section, in the "Service ID:" field put the
name of the service ID for the Service Registry (
localhostin our example). In the "Class:" field put
org.projectmobius.client.registrar.DefaultRegistryImpl - In the "Add Parameters" section, in the "Name:" field put
serviceRegistryFactory
and in the "Value:" field put in the factory
org.projectmobius.client.registrar. DefaultServiceRegistryFactory
- Click "Add" to populate the "Parameters" text area.
- Click "Ok". You will get a dialog window confirming that the
service registry was added.
- The Service Registry will be contacted and the list of GME's in the viewer updated.
The GME will use the Service Registry to populate the viewer with all GMEs that are listed
by the Service Registry. In this case, we show just the one localhost GME added (the only
one that was registered):