Developing Apama Applications > Using Apama Studio > Debugging Apama Java 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 Apama Java application in Apama Studio. To do this, you must open the Java 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 © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.