Skip to main content
Version: Current

GPAL - introduction

The Genesis Platform Abstraction Language (GPAL) is a set of custom Kotlin script definitions that enable you to quickly stand up Genesis services at speed. The scripts also provide a consistent functionality set with the same look and feel throughout.

The most notable characteristics of GPAL are:

  • "Intellisense" provides automatic discovery of syntax, code completion, error checking and more
  • Context-aware properties and default imports facilitate quick definitions
  • Self-describing code with documentation samples
  • Reusable common code blocks in multiple GPAL definitions
  • Tiered architecture conjoined with code generation system (e.g. sysdef to fields, fields to tables, tables to views, etc)
  • Dependency injection is available - so custom code can be used to enhance available functionality
  • Plugin-based architecture enables additional syntax for specific GPAL definitions (i.e. FIX Xlator plugin for streamer/streamerclient)
  • GPAL Script definitions are debuggable and therefore provide additional troubleshooting capabilities when compared to other dynamic configuration languages
  • Overriding capabilities at different levels for more flexibility; for example, field nullability can be defined within the GPAL fields definition, but also overridden at the GPAL tables definition level

GPAL Default imports

The following imports are automatically available inside all GPAL definitions:

    global.genesis.gen.config.tables.*"
global.genesis.gen.config.view.*"
global.genesis.gen.dao.enums.*"
global.genesis.gen.view.entity.*"
global.genesis.gen.dao.*"
global.genesis.commons.model.GenesisSet
global.genesis.commons.model.GenesisSet.genesisSet
org.joda.time.DateTime
org.joda.time.DateTime.now
global.genesis.config.dsl.ScriptModules
gpal.extn.shared.*
global.genesis.message.core.common.*

Some imports are context-aware and will change depending on the application you are building and the GPAL definition you are using. For example, GPAL files can automatically add imports for any classes defined under global.genesis.$productName.message.common.* and global.genesis.$productName.message.$messageType.* where $productName is the name of the application you are building and $messageType matches different GPAL definitions (such as request for request servers, event for eventhandlers, etc.).

Some GPAL definitions also have additional default imports to complement their functionality. For example, GPAL Event handlers have the additional imports available in scope:

        kotlinx.coroutines.async
kotlinx.coroutines.flow.*
kotlinx.coroutines.rx3.await
global.genesis.message.core.event.EventReply
global.genesis.db.DbRecord.Companion.dbRecord
global.genesis.db.EntityModifyDetails
global.genesis.eventhandlertDatabaseWrapper
global.genesis.eventhandler.pal.state.*

GPAL example

Here is a simple example of a GPAL process configuration:

    import java.util.concurrent.TimeUnit

process {

systemDefinition {
item(name = "DbHost", value = "localhost")
item(name = "ClusterPort", value = "5678")
}

cacheConfig {
expireAfterAccess(1, TimeUnit.DAYS)
expireAfterWrite(1, TimeUnit.DAYS)

initialCapacity = 20_000
maximumEntries = 30_000
multipleKeys = true

tables {
table(TRADE, loadOnStart = true)
table(INSTRUMENT, loadOnStart = true)
table(ALT_INSTRUMENT_ID, loadOnStart = true)
table(MARKET, loadOnStart = true)
table(EXCHANGE, loadOnStart = true)
table(CURRENCY, loadOnStart = true)
}
}
}

From the example above, you can see some of the GPAL characteristics:

  • At the beginning, the Java TimeUnit is imported - Java/Kotlin classes can be imported to bring additional functionality.
  • We can override system-definition values (defined in the GPAL System definition file) at the process level. Thanks to the code-like nature of the GPAL definitions, the same syntax and underlying implementation can be reused to provide override capabilities.
  • GPAL table configurations are available by default (e.g. TRADE, INSTRUMENT, ALT_INSTRUMENT_ID, MARKET, EXCHANGE, CURRENCY). But note, if one of these tables is removed from the GPAL table definition, our example process configuration file becomes incorrect, as it references a non-existent table, and it will automatically identify this issue as a compilation error.
  • Simple syntax that can be easily understood in an English-like language.

Troubleshooting

As of IntelliJ version 2023.3, we are aware that intellisense does not always function as it should, which is frustrating. We have a range of measures to work round this issue and restore your normal intellisense predicitions and prompts. The measure or measures that work best depend on your exact set-up. We suggest that you try them all. If you are still not able to use intellisense after that, please contact your Genesis support person.

tip

These steps can be executed in different order, depending on your current project set-up, so try these combinations in different ways.

  • Consider a downgrade to IntelliJ to a version of IntelliJ prior to 2023.3.x, eg: 2023.2.x

  • In your project settings, ensure Kotlin version is set to 1.9.10:

  • Always apply the new Script context when prompted. Auto-reload for Genesis scripts is helpful in this case, so consider enabling all Genesis script definitions:

  • If using Gradle, try reloading the projects:

  • Not opening the project from recent projects avoids intermittent freezing:

  • Try invalidate cache / restart: