Talend service activity monitoring - easysoa/EasySOA GitHub Wiki
Study of Talend SAM architecture
service : MonitoringService.putEvents() https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-common/src/main/java/org/talend/esb/sam/common/service
agent :
- source https://github.com/Talend/tesb-rt-se/tree/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent
- monitoring events produced by interceptor https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/eventproducer/EventProducerInterceptor.java
- with the following info : https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/eventproducer/MessageToEventMapper.java
- then collected at bus level and sent to remote (central) sam service https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/collector/EventCollector.java
- by spring scheduler (by default 500 ms) https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/resources/META-INF/tesb/agent-context.xml
server : persists monitoring events using spring jdbctemplate, simple servlet based ui https://github.com/Talend/tesb-rt-se/tree/master/sam/sam-server/src/main/java/org/talend/esb/sam/server
on both sides : handlers (password removal, custom info), filters (jxpath)
Installation Talend Service Activity Monitoring server (working with mysql) in Easysoa :
- Copy mysql-connector-java-5.1.22-bin.jar in serviceRegistry/lib
- Copy sam-server-war.war in serviceRegistry/webapps
- Copy create_mysql.sql file in serviceRegistry/webapps/sam-server-war/WEB-INF or create manually the base (base name => samDB, prefered solution) in mysql with this script. Warning : the storage engine for the database tables must be 'MyIsam'. If it is not the case, the SAM server will send back a success response but the events will not be persisted in the database. The MySQL server is not included in EasySOA.
- Open the tomcat context.xml file in serviceRegistry/conf/ and add this resource tag :
<Resource name="jdbc/datasource" auth="Container"
type="javax.sql.DataSource" username="root" password=""
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/samDB"
maxActive="8" maxIdle="30" maxWait="10000"/>
- Modify the file serviceRegistry/webapps/sam-server-war/WEB-INF/logserver.properties : comment the derby block and uncomment the mysql block
...
#for Derby (by default)
#db.datasource=java:comp/env/jdbc/datasource
#db.dialect=derbyDialect
#db.recreate=true
#db.createsql=create.sql
#for Mysql
db.datasource=java:comp/env/jdbc/datasource
db.dialect=mysqlDialect
db.recreate=false
db.createsql=create_mysql.sql
...
To check if the SAM server is started, go to : http://localhost:8080/sam-server-war/
.
The following screen must be displayed :
- The SAM server Web Service WSDL can be found here : http://localhost:8080/sam-server-war/services/MonitoringServiceSOAP?wsdl
Using SAM from FraSCAti
Using SAM from FraSCAti - v1 : call SAM Server from a dedicated CXF Intent
Architecture of the solution :
The CXF Monitiring intent is based on FraSCAti CXF Intents. This intent work with a FraSCAti binding ws reference to the SOAP web service exposed by the SAM server. Here is the intent composite.
The CXFMonitoringIntent class extends the AbstractHandlerIntent class and implements the Handler interface. With the handleMessage(MessageContext context) method, we have access to the CXF Message context and to the CXF Message. The CXF message is then transformed by a MessageToEventMapper object into a SAM Event and send to the server.
The CXF monitoring intent can be used only on a FraSCAti binding.ws tag. Here the sample composite
The sources of the CXF Monitoring intent are available here : https://github.com/easysoa/EasySOA/tree/master/easysoa-proxy/easysoa-proxy-intents/easysoa-proxy-intents-cxfMonitoringIntent
limits : no message id or flow id, so can't correlate among req / resps & client / server
Using SAM from FraSCAti - LATER v2 alternatives : call SAM Server from a dedicated CXF Intent
- Add Message & FlowIdProducer using another CXF InterceptorIntent, like in https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/feature/EventFeature.java
- Try using SAM Agent by setting up its feature from FraSCAti as in https://github.com/Talend/tesb-rt-se/blob/master/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/feature/EventFeature.java
- either in CXF InterceptorIntents,
- or by writing a new CXFFeatureIntent TODO Q pmerle ?