Service Debugging¶
Backendless supports the "remote-registration-local-debugging" model. This means that the service code can be debugged locally on the developer's computer while the service registration and its API endpoints become available through Backendless. API requests for a service in debug can be sent to Backendless and it routes them to the local debugging process running on the developer's computer. The diagram below illustrates the model:
To start the local debugging process:
- Open a command prompt and change the current directory to
<PROJECT-DIR>
. - Run the following command to start the CodeRunner process:
- on Linux:
./bin/CodeRunner.sh
on Windows:
./bin/CodeRunner.bat - When CodeRunner starts, it displays the following message:
Listening for transport dt_socket at address: 5005
[INFO] JDK from "JAVA_HOME" - /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
[INFO] CodeRunner(tm) Backendless Debugging Utility
[INFO] Copyright(C) 2017 Backendless Corp. All rights reserved.
[INFO] Version: 4.0.0 Build date: 2017-05-05T13:48:19Z
[INFO] CodeRunner session is running for 2 hours and will be terminated on 00:03:31.562[UTC]
[INFO] Registering runner on: 'http://api.backendless.com'
[INFO] Application ID: 'F3A5A127-XXXX-XXXX-XXXX-4FF9FA181800'
[INFO] Secret key: '3DF7B59A-XXXX-XXXX-XXXX-455442C71100'
[INFO] Runner successfully registered
[INFO] Parsing event model...
[INFO] Run dependency analyzer for app: F3A5A127-XXXX-XXXX-XXXX-4FF9FA181800
[INFO] Analyze service: com.mbaas.shopping.ShoppingCartService
[INFO] Analyze service: com.sample.api.DemoService
[INFO] Build successfully: 0 handlers, 0 timers, 2 services
[INFO] Deploying model to server, and starting debug...
[INFO] Model successfully deployed.
[INFO] Waiting for events...
- When deploying a service, it is recommended to review the initial CodeRunner output. Notice the following lines:
[INFO] Analyze service: com.sample.api.DemoService
[INFO] Build successfully: 0 handlers, 0 timers, 2 services
[INFO] Deploying model to server, and starting debug...
[INFO] Model successfully deployed
These lines confirm that the Java classes in the project are recognized as services and that they are properly registered with Backendless. - At this point the service is registered with Backendless, any invocation of the service operations will be routed to your local CodeRunner.