CodeRunner¶
Custom server code development, debugging and runtime execution in Backendless is made possible with a special utility/container called Backendless CodeRunner™. It is available for download from the Backendless website and is also automatically included into the server-side code/projects generated using Backendless console. The CodeRunner SDK includes several command line tools enabling the process of debugging custom server-side code and subsequently deploying it to Backendless. It is important to note that CodeRunner makes it possible to debug custom code entirely on the developer's computer while the custom code is "plugged into" the API workflow in the cloud. This means any custom code whether it is an API service, API event handler or a timer, can be debugged using the traditional approaches (line-by-line code step through, variable inspection, STDOUT logging) by invoking that code through the centralized Backendless Cloud service. See the Development and Debugging section for details.
The process of developing custom business logic with Backendless is slightly different between API services and event handlers/timers. The only difference is the latter may include the step of code-generation which simplifies the workflow.
API Event Handlers and Timers¶
Backendless supports two approaches for developing custom business logic:
- Expressive, code-driven approach. With this approach a developer bypasses code generation and builds the custom code for event handlers and timers by using the published APIs.
- Declarative, console-driven approach. This approach relies on a code generator built into Backendless Console. Using the code generator developer selects the API events and configures schedules for timers for which he intends to add custom logic. The system automatically generates the code which can be downloaded for further development.
The diagram below illustrates the process:
where: - Developer generates code for event handlers and configures timer schedules using Backendless Console. The console includes a code generator which creates the place holder Java code for the API events and timers. The code can be downloaded as a project archive which includes project files for IntelliJ IDEA and Eclipse IDEs. This step is optional, but it significantly simplifies the development process and saves development time.
- Using an IDE developer writes custom business logic. The compiled code is passed to CodeRunner™, which is a command line utility used for local debugging of the custom business logic code. Developer can optionally attach to the CodeRunner™ process to set breakpoints in the code for the line-level debugging.
- CodeRunner™ registers with the Backendless Cloud Service. It instructs Backendless to route the API and timer events to the developer computer for the debugged code.
- Client application sends an API request. Backendless determines if there is an event handler registered for the received API request and routes the event information to CodeRunner™.
- CodeRunner™ receives the request and executes the code. Developer can inspect and debug invocations locally before the custom code is deployed to the production environment.
API Services¶
The workflow of developing API services is illustrated in the diagram below:
where:
- Developer downloads and installs the Backendless CodeRunner SDK. Using an IDE developer writes the service code. The compiled code is passed to CodeRunner™, which is a command line utility used for local debugging. Developer can optionally attach to the CodeRunner™ process to set breakpoints in the code for step-by-step debugging.
- CodeRunner™ registers with the Backendless Cloud Service. It instructs Backendless to route the service invocation requests to the developer computer for the debugged code.
- Client application sends a service API request. Backendless determines if there is a service registered for the received API request and routes it to CodeRunner™.
- CodeRunner™ receives the request and executes the code. Developer can inspect and debug invocations locally before the custom code is deployed to the production environment.