Developing Apama Applications > Using Apama Studio > Debugging JMon Applications > Example debug session > Example of debugging in Apama Studio
Example of debugging in Apama Studio
You want to connect to the remote correlator and debug the JMon application in Apama Studio. To do this, you must open the JMon project (or the Apama project with Java support enabled) in Apama Studio and create a debug launch configuration. This launch configuration connects to the remote Java application, which is the JVM in the running correlator.
For test purposes, suppose that you create a simple breakpoint in the match() method in Simple.java. This suspends execution when the correlator reaches a matching event listener.
Send the following events to the correlator to trigger the breakpoint:
Tick("ibm", 1.0)
Tick("ibm", 5.0)
Tick("ibm", 15.0)
Tick("msft", 15.0)
As you can see, the debugger stops execution at the specified code breakpoint after the listener finds the first Tick event with a price greater than 10.0, that is Tick("ibm", 15.0).
Suppose that you want to examine the heap context, that is, the values of the variables. You can observe this in the top left Debug panel of the Apama Runtime perspective. Select the Simple.match method stack frame from Thread[ApamaProcessing]. For example:
Note that the top right Variables view now shows the proper stack frame context with all relevant heap space variable values. The tick variable, defined in the code, is not yet visible. This is because execution was suspended before the current line was executed. To execute the current line, which extracts the matching Tick event and assigns it to the tick variable, click Step Over in the Debug panel toolbar. As you can see, the tick variable now appears in the Variables view. You can select it to inspect its value, which is, of course, Tick("ibm", 15.0).
Copyright © Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its Subsidiaries and or/its Affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.