Comment on page
How parts of a Grainite app can be developed in multiple supported programming languages
Currently, the supported languages for multi-language apps are Java and Python, though Grainite plans to provide support for other languages in the future.
- table_name: person_table
- name: TopicEventHandler
- action_name: handleTopicEvent
- name: GreetingHandler
- action_name: handleGreeting
Grainite apps can be developed in different language and the Grainite server can run multiple apps implemented in different languages simultaneously. However, this page describes how parts of a single Grainite app can be implemented in different languages. For example, a Java developer might create a Grainite app and implement all of its action handlers in Java, then a Python developer can later write a client program in Python to send workloads to the app. The Python developer may also add further action handlers to the app, so that some of the app's action handlers are implemented in Java and some in Python.Generally, a Grainite application is comprised of:
A single Grainite app always has one YAML config file; but it can have multiple action handlers and, similarly, multiple client programs which interact with it. A single action handler and likewise a single client program can be implemented in any language for which Grainite exposes an API. The following are thus true for a Grainite app:
- A single app's action handlers do not need to be implemented in the same language as its client programs
- A single app's action handlers can be implemented in different languages within the same app (see App Configuration Options)
- A single table can have multiple action handlers associated with it that are implemented in different languages. The language of an action handler and the source code where the implementation exists are specified in the action_handler configuration.
- However, all of the
action_handlermust be implemented in the same language as their parent
- A single app's client programs can be implemented in different languages
At a high level, the following must be done when developing different parts of a Grainite app in multiple languages:
- You implement your action handlers in one or more supported languages
- In application YAML config file, you specify the language you use to implement each action handler and the location of the source code in the configuration options for each
action_handler. Note that there are other app configuration settings that may need to be specified depending on the language(s) you use, such as the
jarsif any action handlers are implemented in Java (see App Configuration Options).
- You implement your client program(s) in one or more supported languages. No configuration in the app's YAML file is needed for client programs; and you can later add client programs as needed without changing the app configuration.