Question

General question on intercepting C++ method calls...

Are there any open-source frameworks? Using Tuxedo (11+) as my container so basically I want to do an "around" on successful tpcall calls. TSAM from Tuxedo does this as an extension but I would rather skip the TSAM elephant and trap tpcall calls myself.

Ideas?

Was it helpful?

Solution 2

I think there are 2 possible solutions:

1) The simplest one is to implement tputrace(3c) function and libutrace.so and catch tpcall or tpservice there. The downside of this approach is that you will have to turn on tmtrace for you application which I wouldn't rely on for business functionality. It's fine for monitoring, debugging, etc.

2) Implement custom TSAM+ Tuxedo plug-in. You can enable just your own plug-in and skip mondebug, monshm elephants. Or you can skip TSAM+ completely and implement plug-in for undocumented engine/tsam/agent interface.

I wrote about similar problem for my DIY Tuxedo monitoring

OTHER TIPS

If you want to intercept service MYSERVICE, you can write write an general service named INTERCEPTOR and do the following:

  1. Unadvertise MYSERVICE and advertise it with name INTER_MYSERVICE
  2. Advertise the INTERCEPTOR with the name MYSERVICE
  3. The INTERCEPTOR-service must look with which name it was called (MYSERVICE) and has to forward the call to the service with name INTER_name, in this case INTER_MYSERVICE.

This configuration can be done dynamically without restarts.

I use this for debugging/logging-purpose in development, where it works quite well. I'm not sure whether I would use it in production. Also we only use XOCTET buffer-types, which makes it easier, but I think it should work with different buffer-types as well.

Also doing it for hundreds of services at the same time might become a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top