|
17.1 Discovery Service : An Overview
17.2 The Discovery Service MBean
17.3 Creating the Discovery Service MBean
17.4 The Discovery Client
17.5 Performing the Discovery Operation
17.6 Running the Example
17.1 Discovery Service : An Overview
Multi-Protocol agents in a network can be discovered using the AdventNet Discovery Service. The discovery service enables the Multi-Protocol agents to be discovered in a network. This service relies on a discovery client object, which sends out multicast requests to find agents. In order to be discovered, an agent must have implemented the discovery service. This functionality allows interested applications to establish a list of active Multi-Protocol agents and keep it updated.
In addition to knowing about the existence of an agent, agent applications are free to use the discovery service since they may require such information for cascading (refer topic Master-Subagent Architecture in Multi-Protocol Agent) . To provide Remote manageability of the discovery service in an agent, all of its components are implemented as MBeans.
17.2 The Discovery Service MBean
Agent Toolkit provides the Discovery Service as a MBean. Multi-Protocol agents should have com.adventnet.services.discovery.DiscoveryService MBean registered with the MBean Server to be discovered by the discovery client.
The Discovery mechanism uses XML over UDP (multicast datagram socket) for communication between the agent (discovery service) and discovery Clients. This enables,
Discovery information to be extended without changing the existing client or agent.
Achieving backward compatibility, i.e., discovery client can discover Multi-Protocol agents with different versions of Discovery Service MBean.
|
|
Note: The Multicast group is a combination of Class D IP Address and standard UDP port number to which the recipients are subscribed to listen for the packets. Multicast group IP addresses are in the range 224.0.0.1 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used. The default multicast group IP Address for AdventNet discovery service is 225.225.225.0 and multicast port is 8222.
Time to live is an 8 bit unsigned byte associated with each multicast packet to determine how many hops it can travel. When this reaches zero, the packet is completely discarded. Time to live ranges from 0 - 255. |
17.3 Creating the Discovery Service MBean
You can create the discovery service MBean using the JMX Compiler UI or using the API.
Using JMX Compiler UI
You can configure the Multi-Protocol agent with discovery service by following the steps given below:
Select Project -> Settings option. In the Settings tree structure, select AdventNet Services -> Discovery, which displays the Discovery dialog on the right side.
Select the option Enable Discovery Service.
Enter the following details :
The multicast group IP Address for discovery service.
The multicast group port number.
The time to live.
User Key and User Value
On code generation, the above entry adds the necessary code to register the Discovery Service with the given multicast group IP Address and port number.
Using API
|
import com.adventnet.services.discovery.DiscoveryService; Properties userData = new Properties(); |
The above code snippet registers the discovery service MBean with multicast group IP Address 225.225.225.255 and multicast port 8222.
The Discovery client service enables to discover AdventNet Multi-Protocol agents in a network. Discovery clients can only discover the agents listening on the same multicast group and port and which has implemented the discovery service.
The DiscoveryClient class provides methods to discover agents. The discovery client (com.adventnet.services.discovery.DiscoveryClient) is the client that sends the broadcast packet when it comes up. The Multi-Protocol agents (with discovery service) running in the network will respond to it with the information such as Host Name, MBean Server ID, Adaptors/Connectors information.
Discovery Client Code Snippet
|
DiscoveryClient client = new DiscoveryClient(); |
The default multicast group IP address is 225.225.225.255 and port Number is 8222. These may be set to other values through the MulticastGroup and MulticastPort attributes. Before initiating searches, you must call the discovery client’s start method. This creates its multicast socket and joins the multicast group used for broadcasting its discovery request.
The scope of the discovery request depends on the time-to-live used by the multicast socket. Time to live ranges from 0 - 255. You can modify this value at any time by setting the discovery client’s TimeToLive attribute.
By default, a discovery client waits for responses for five second after it has sent a discovery request. This period can be customized by setting a value in milliseconds for its TimeOut attribute.
17.5 Performing the Discovery Operation
The AdventNet MBean Browser is a Manager application, which enables the user to access a Multi-Protocol agent's MBeans and use the provided services through the RMI/ CORBA/ HTTP protocol adaptor. To perform the discovery operation from MBean Browser, follow the steps given below :
Start MBean Browser
Select the option Settings -> Discovery. This displays the Discovery Service Panel . Here, the default multicast group for AdventNet discovery service is 225.225.225.255 and multicast port is 8222. You can change this to any other IP Address and Port number. Also, specify the Timeout value within which the discovery client has to discover the Multi-Protocol agent.
Click the Start button. This discovers the Multi-Protocol agents running in the network , which has implemented the discovery service with the same multicast group IP address and port.
Connecting to the discovered agent
To connect to a discovered agent,
Select the IP Address of the discovered agent and right-click.
From the right click menu, select Connect option to connect to the server using RMI/CORBA/HTTP.
Now, you will be able to view the list of MBeans registered with the Multi-Protocol agent
Viewing properties of the discovered agent
To view the properties of the discovered agent,
Select the IP Address of the discovered agent and right-click.
From the right click menu, select Properties option. This displays the following agent properties:
Host Name
MBeanServerId
The port number of the adaptors
|
|
Note: To be discovered by the discovery client :
|
Please refer the Discovery Service example present in the <Agent Toolkit Home>/example/jmx/discovery directory. This is a simple example to illustrate the usage of discovery service provided by the Agent Toolkit.
The Readme.html file explains the usage of the example and the steps involved in running the example .
|