Use AspectJ to connect PurePaths in Tibco BusinessWorks

This page describes how to use AspectJ for technologies where PurePaths are not supported end-to-end out of the box. AppMon provides full end-to-end visibility, but you can use this page to understand how to use AspectJ for other technologies where PurePaths are not supported end-to-end out of the box. It includes examples of what can be done in Tibco BusinessWorks with AppMon. It also shows what could be done using AspectJ to join broken PurePaths(PPs) together using ADK calls.

Note

Examples on this page include downloadable session files containing the sensors used in the examples. In some cases, the sensors include more that what is needed to capture required PurePath data. At a minimum, the following should be captured:

  • JobDispatcher.schedule(Job) - Capture the Job parameter as it provides the Job-Id.
  • JobDispatcher$JobCourier.a(Job) - Capture the Job paramater as it also provides the Job-ID.
  • HawkJobListener.transitionEvaluated(String, String, String, boolean) - Capture the string values as they contain the Process name, the last complete activity in the process, and the transition of what activity is being called next.
  • TaskImpl.eval(ProcessContext) - This method is the timing of how long the activity that was transitioned to (from the previous transitionEvaluated() call) took.

Example 1: Tibco BusinessWorks hosting a WebService

The following graphic shows a process called QueryBooksByAuthor that implements a WebService.

Transitions between nodes in the process flow are labeled “[srcNode]2transition2[dstNode]”.

The Call Process node calls out to the Query Process shown below.

The following screenshot shows what can be captured using AppMon:

For the next example, download the following AppMon Session File: bwsoapserver-ootb.dts

This example shows two disconnected PurePaths. Manually placing some sensors can capture the Job Names (Job-47002) from both PurePaths. However, you must place two different sensors, which means a single Business Transaction (BT) can’t bring these PurePaths together.

In the transitionEvaluated() method, capturing some of the arguments provides the ProcessName, the Current node, and the transition being executed. The eval() method/s after the transitionEvaluated() call is really the invocation of the next node in the Process.

Using AspectJ to weave in the ADK calls can connect these PurePaths. Below is a screenshot of what the PurePaths looks like when this is done.

The following AppMon Session file bwsoapserver-with-aspectj-adk.dts shows these two PurePaths are now joined together into a single PurePath.

The following screenshot shows the code for bwtagging.aj aspect.

Download the AspectJ Download: bwtagging.aj

Example 2: Tibco BusinessWorks queue receiver

The following screenshot shows a process that listens to a queue, echoes the message back on the response queue and then writes to a log file.

AppMon shows the following disconnected PurePath for this process.

This AppMon Session File bwjms-ootb.dts

Shows three separate PurePaths.

The Aspect defined above joins the PurePaths running in BusinessWorks together, but the PurePaths are still disconnected from the JMSClient. It appears BusinessWorks uses methods to handle JMS that isn’t currently tagged in AppMon. Adding another Aspect to extract the AppMon PurePath ID from the JMS property and passing that to the ADK connects the PurePaths, as shown in the following screenshot.

It also shows in this AppMon Session file. bwjms-with-aspectj-adk.dts

Here’s the code to the bwjmstagging.aj aspect:

Download the AspjectJ file: bwjmstagging.aj

Example 3: connecting PurePaths for outbound SOAP requests

The following shows a BusinessWorks process that makes a SOAP request every 60 seconds to another process detailed in Example 1 above:

This screenshot shows this in AppMon. With some custom sensors, and four separate PurePaths.


These also display in this AppMon Session File bw-soap-ootb.dts

Using AspectJ, you can use these fixes, which would give two PurePaths. But an additional fix is needed to connect the outbound HTTP request that is part of the SoapRequestReply action.


This is also shown in this AppMon Session file bw-soap-aspectj.dts

The outbound executeMethod is now connected to Job-106010. When the call happens to the SOAP service (Job-106011) it is also connected in the PurePath.

Here’s what the AspectJ code looks like:


Download the AspjectJ file: bwhttptagging.aj

Instrument BusinessWorks with AspectJ and ADK

  1. Install AspectJ to an easily accessible path on the machine running BusinessWorks. For example c:\aspectj1.7

  2. Install the ADK. You can copy the ADK files into <BW_HOME>/hotfix/lib so they would automatically be added to the BusinessWorks classpath.

  3. Copy over the compiled aspect files.

  4. Create an aop.xml configuration file for AspectJ in <BW_HOME>/hotfix/lib/META-INF/aop.xml
    The contents of the file should look similar to the following.

    Download the aop.xml file: aop.xml
    As an alternative, you can also build a .jar file of the Aspects in Step 3 and the aop.xml in Step 4 and place that in <BW_HOME>/hotfix/lib instead.

  5. Add the AspectJ load time weaver to the BusinessWorks’ .tra file to the same location where you add the dT agent, for example <BW_HOME>/bin/bwengine.tra.

The following is an example added the following at the bottom of the BusinessWorks’ .tra file.

java.extended.properties=-javaagent:c:/aspectj1.7/lib/aspectjweaver.jar -agentpath:c:/tibco/dT/agent/lib/dtagent.dll=name=BW,server=127.0.0.1
  1. Restart the bwengine.