The Location Service Example

This example illustrates VisiBroker for Java's location service. It enables developer code to discover, or be notified of, object instances that have particular attributes, such as satisfying an interface. The location service can be used for any function that requires knowledge of what objects are presently accessible and where they are. This information could be used for load balancing or debugging. This example subdirectory also contains a program illustrating triggers which are a part of the Location Service. Triggers are an asynchronous alternative to polling the OSAgent to learn when an instance becomes available or becomes unavailable. Note that usage of the LocationService (the OSAgent interface) with VisiBroker for Java currently requires the execution of the standalone server locserv which is provided with the VisiBroker for Java release. The program is shipped as part of the archive of platform-specific executables and scripts which should have been installed in the directory bin. Assuming the installation's bin directory has been added to your path, this executable can be run with the command:




From this example, you will learn how to:

Directory Contents

Running this example

To run the examples, first make sure that the VisiBroker Smart Agent (osagent executable) is running on your network. You should also have the Location Service (locserv executable) running on your network. Then start the Bank Server from the Bank example using the command:

Next, start the AccountFinder, Find and AccountTrigger programs:

Note that the Location Service detects the Bank Server. Kill the bank server and again run the AccountFinder program as indicated above. Notice the change in output.

To test the find program, start one or more bank servers (or other servers). The Find program provides with a command line user interface which allows the user to obtain information about specific objects using their repository id. To obtain a list of the options the Find program provides, start the Find program and type at the shell prompt it provides.

The AccountTrigger program will notify the user when a provider goes down or when a provider comes back up. Try running the AccountTrigger program after either starting the bank server or stopping the bank server.



Return to the top-level examples page.