... | ... | @@ -49,7 +49,7 @@ Add dependecy : |
|
|
<dependency>
|
|
|
<groupId>eu.chorevolution.vsb</groupId>
|
|
|
<artifactId>vsb-manager-api</artifactId>
|
|
|
<version>2.1.0</version>
|
|
|
<version>2.1.2</version>
|
|
|
</dependency>
|
|
|
```
|
|
|
|
... | ... | @@ -63,7 +63,51 @@ After executing this lines of codes, the BC will be generated into the temporary |
|
|
|
|
|
**4. Monitoring services and things**
|
|
|
|
|
|
To monitor services and things,
|
|
|
To monitor services and things, VSB provides two APIs that can be inlude into services or things to monitors.
|
|
|
|
|
|
Add maven dependency
|
|
|
|
|
|
```
|
|
|
<dependency>
|
|
|
<groupId>eu.chorevolution.vsb</groupId>
|
|
|
<artifactId>monitor</artifactId>
|
|
|
<version>2.1.2</version>
|
|
|
</dependency>
|
|
|
```
|
|
|
|
|
|
* Probe injection with the Agent API :
|
|
|
The agent has to be injected into the code of the service or things to monitor, at entry and exit point of the function or operation to monitor.
|
|
|
|
|
|
|
|
|
```
|
|
|
// To To initialize the Agent object
|
|
|
Agent agent = new Agent("NAME_OF_SERVICE_OR_THING_TO_MONITOR", "HOST_ADDRESS_OF_SERVICE_OR_THING_TO_MONITOR", PORT_NUMBER_OF_SERVICE_OR_THING_TO_MONITOR);
|
|
|
// To fire an event to the listener
|
|
|
String event = "event";
|
|
|
agent.fire(event);
|
|
|
|
|
|
//This method will fire a following information : timestamp+"-"+event+"-NAME_OF_SERVICE_OR_THING_TO_MONITOR";
|
|
|
```
|
|
|
|
|
|
* API Listener :
|
|
|
|
|
|
```
|
|
|
// To initialize the AgentListener object
|
|
|
AgentListener listener = new AgentListener("NAME_OF_SERVICE_OR_THING_TO_MONITOR", "HOST_ADDRESS_OF_SERVICE_OR_THING_TO_MONITOR", "PORT_NUMBER_OF_SERVICE_OR_THING_TO_MONITOR");
|
|
|
|
|
|
// To open connection with the SERVICE_OR_THING_TO_MONITOR
|
|
|
listener.connect();
|
|
|
|
|
|
// To get the monitored informations
|
|
|
while(listener.isConnect()){
|
|
|
|
|
|
String data = listener.getMessageListened();
|
|
|
System.out.println(data);
|
|
|
}
|
|
|
|
|
|
// To close connection with the SERVICE_OR_THING_TO_MONITOR
|
|
|
listener.disconnect();
|
|
|
```
|
|
|
|
|
|
**5. Who do I talk to?**
|
|
|
|
... | ... | |