
h2. Implementations
The DSB has its own monitoring collectors and APIs and is totally independent from any monitoring tools. This API can be found in module dsb-monitoring-api. Different implementations are provided by default and are listed below.
h3. EasierBSM implementation
A default implementation shipped with the default distribution is based on top of [EASIERBSM|easierbsm:EasierBSM - Open source Business Service Monitoring and SLA enforcement]. At the implementation level, it means that every time an endpoint is activated in the DSB, an endpoint registry listener sends a registration query to easierBSM. Then, each time a message is exchanged between a service consumer and provider, the DSB monitoring modules will send reports to easierBSM layer, translating DSB monitoring data to easierBSM one.
h4. Configuration
The monitoring configuration file is available at DSB_HOME/conf/monitoring.cfg (a standard property file with key/value pairs). Parameters are:
* monitoring.active=BOOLEAN where BOOLEAN is true or false: Activate or not monitoring by static configuration. Note: Changing this parameter value at runtime has no effect.
* monitoring.base=TBD
* monitoring.admin=URL where URL is the URL of the monitoring management endpoint ie the one which will receive the new registration query as described above.
* monitoring.listener=
h3. Web service notification implementation
Another monitoring implementation is based on Web service notification (WSN). Each time a message is exchanged between a service consumer and provider, a report is generated and sent to the internal WSN engine. If there are some subscribers which are interested in the monitoring data, they will be notified by the WSN engine with the monitoring data inside a WSN notify message such as:
{code:language=xml|title=Monitoring notification}<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:To>http://localhost:9000/services/RawService</wsa:To>
<wsa:MessageID>urn:uuid:AFB9DC2D92AA52CBFF1317110458490</wsa:MessageID>
<wsa:Action>urn:NotifyResponse</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<wsnt:Notify xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
<wsnt:NotificationMessage>
<wsnt:SubscriptionReference>
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:9000/services/RawService</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing" />
</wsnt:SubscriptionReference>
<wsnt:Topic xmlns:dsb="http://www.petalslink.org/dsb/topicsns/"
Dialect="http://www.w3.org/TR/1999/REC-xpath-19991116">dsb:MonitoringTopic</wsnt:Topic>
<wsnt:ProducerReference>
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">dsb://MonitoringNotifcationSender</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing" />
</wsnt:ProducerReference>
<wsnt:Message>
<ReportListBean xmlns:ns2="org.petalslink.dsb.monitoring.api">
<reports>
<exchangeId>petals:uid:748E3B7E2B7A0FCD1213171104582349260003</exchangeId>
<serviceName>{http://api.ws.dsb.petalslink.org/}HelloServiceService</serviceName>
<endpoint>HelloServicePort</endpoint>
<operation>{http://api.ws.dsb.petalslink.org/}sayHello</operation>
<itf>{http://api.ws.dsb.petalslink.org/}HelloService</itf>
<consumer>null ->null (CONSUMER):subdomain1/0/petals-bc-soap</consumer>
<provider>{http://api.ws.dsb.petalslink.org/}HelloServiceService</provider>
<isException>false</isException>
<contentLength>169</contentLength>
<date>2011-09-27T10:00:58.269+02:00</date>
<type>t1</type>
</reports>
<reports>
<exchangeId>petals:uid:748E3B7E2B7A0FCD1213171104582349260003</exchangeId>
<serviceName>{http://api.ws.dsb.petalslink.org/}HelloServiceService</serviceName>
<endpoint>HelloServicePort</endpoint>
<operation>{http://api.ws.dsb.petalslink.org/}sayHello</operation>
<itf>{http://api.ws.dsb.petalslink.org/}HelloService</itf>
<consumer>null ->null (CONSUMER):subdomain1/0/petals-bc-soap</consumer>
<provider>{http://api.ws.dsb.petalslink.org/}HelloServiceService</provider>
<isException>false</isException>
<contentLength>169</contentLength>
<date>2011-09-27T10:00:58.287+02:00</date>
<type>t2</type>
</reports>
<reports>
<exchangeId>petals:uid:748E3B7E2B7A0FCD1213171104582349260003</exchangeId>
<serviceName>{http://api.ws.dsb.petalslink.org/}HelloServiceService</serviceName>
<endpoint>HelloServicePort</endpoint>
<operation>{http://api.ws.dsb.petalslink.org/}sayHello</operation>
<itf>{http://api.ws.dsb.petalslink.org/}HelloService</itf>
<consumer>null ->null (CONSUMER):subdomain1/0/petals-bc-soap</consumer>
<provider>{http://api.ws.dsb.petalslink.org/}HelloServiceService</provider>
<isException>false</isException>
<contentLength>182</contentLength>
<date>2011-09-27T10:00:58.369+02:00</date>
<type>t3</type>
</reports>
<reports>
<exchangeId>petals:uid:748E3B7E2B7A0FCD1213171104582349260003</exchangeId>
<serviceName>{http://api.ws.dsb.petalslink.org/}HelloServiceService</serviceName>
<endpoint>HelloServicePort</endpoint>
<operation>{http://api.ws.dsb.petalslink.org/}sayHello</operation>
<itf>{http://api.ws.dsb.petalslink.org/}HelloService</itf>
<consumer>null ->null (CONSUMER):subdomain1/0/petals-bc-soap</consumer>
<provider>{http://api.ws.dsb.petalslink.org/}HelloServiceService</provider>
<isException>false</isException>
<contentLength>182</contentLength>
<date>2011-09-27T10:00:58.369+02:00</date>
<type>t4</type>
</reports>
</ReportListBean>
</wsnt:Message>
</wsnt:NotificationMessage>
</wsnt:Notify>
</soapenv:Body>
</soapenv:Envelope>{code}
h4. Configuration
* The WSN implementation provides an API to activate/deactivate monitoring (_org.petalslink.dsb.ws.api.PubSubMonitoringManager_) and get some additional information about the WSN monitoring stuff. This API is automatically exposed by the DSB as a Web service at startup and is available at [http://HOST:PORT/petals/ws/PubSubMonitoringManager].
* To receive notifications containing the monitoring data, interested parties must subscribe to the monitoring topic which is defined as a complete QName:
** name : MonitoringTopic
** NS : [http://www.petalslink.org/dsb/topicsns/]
** prefix : dsb
An example of subscription payload can be
{code:language=xml}<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<wsn:Subscribe xmlns:wsn="http://docs.oasis-open.org/wsn/b-2"
xmlns:add="http://www.w3.org/2005/08/addressing" targetnamespace="http://docs.oasis-open.org/wsn/b-2">
<wsn:ConsumerReference xmlns:wsn="http://docs.oasis-open.org/wsn/b-2"
xmlns:add="http://www.w3.org/2005/08/addressing">
<add:Address>http://localhost:9001/MonitoringSubscriber</add:Address>
</wsn:ConsumerReference>
<wsn:Filter>
<wsn:TopicExpression Dialect="http://www.w3.org/TR/1999/REC-xpath-19991116"
xmlns:dsb="http://www.petalslink.org/dsb/topicsns/">
dsb:MonitoringTopic
</wsn:TopicExpression>
</wsn:Filter>
</wsn:Subscribe>
</soapenv:Body>
</soapenv:Envelope>{code}
In the previous snippet, each time a monitoring message is published to the MonitoringTopic, the subscriber will receive a notification at [http://localhost:9001/MonitoringSubscriber].
More information on how to use WSN stuff and clients are explained in the WSN Page.
h4. Code
All the code of this implementation is located in the _dsb-kernel-pubsubmonitoringservice_ module.