PlatformApplicable to all products in Temenos Journey Manager. | Platform Developer | All versions This feature is related to all versions.
Journey Manager is based on an extensible service-oriented architecture, which enables developer to implement highly configurable services written in GroovyGroovy is a powerful scripting language which runs on the Java Virtual Machine. Across theTemenos Journey Manager platform, Groovy is used to create services in Manager. These services are primarily used to create plug-in style systems that interact with Manager. language. There are two types of service to choose from to implement a new Groovy service: Fluent Groovy service and Groovy service. The main difference between them is:
It is strongly recommended to use the Fluent Groovy service for any new clients, services and applications development. If this can't be done due to limitations in the Fluent APIs, Groovy services must be used. However, some efforts must be made to migrate existing Groovy services to Fluent ones, whenever possible, because Manager future version will force everyone to only use the Fluent APIs.
The detailed difference between the services is outlined below.
The Fluent Groovy service is a service that can only use Transact Fluent API. It is impossible to call any Transact Core API from this service. The reasons are as follows:
import com.avoka.tm.svc.*
def params = [:] params.refNumber = ...
def result = new GroovyServiceInvoker()
.setServiceName("Ref Lookup")
.setClientCode("maguire")
.setVersion("0.2.1")
.invoke(params)
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import javax.servlet.http.*
class FluentDynamicData {
public Logger logger
String invoke(SvcDef svcDef, Txn txn, HttpServletRequest request, User user) {
String data = '''{ "address": { "firstLine": "123 Wall Street" } }'''
return data
}
}
Developers are encouraged to create new services as Fluent Groovy services. Developers might encounter a few situations when it is difficult, if yet possible, to implement a service using Fluent Groovy service (due to Transact Fluent API limitations). However, it can be resolved on case by case basis. For more information, see Fluent Groovy Service Developer Guide.
Fluent services can only invoke Dynamic Groovy services, if the Groovy Secure API restriction is not enforced. This restriction is configured during Manager installation or upgrade by selecting or clearing the Use only the Fluent API checkbox. For more information, see the Installation Guide > Security Configuration > Use only the Fluent API.
The Groovy Service uses both Transact Core API and Transact Fluent API, which allows developers to implement nearly any service possible. However, there are number of disadvantages that are listed below:
System.exit()
, or directly manipulate with database objects.
import com.avoka.core.groovy.GroovyLogger as logger
def data = '''{
"address": {
"firstLine": "123 Wall Street"
}
}'''
return data
Developers are discouraged to create new services using core Groovy services, which are considered the legacy API and have been deprecated since Journey Manager version 19.11. Instead, whenever possible, use Fluent Groovy Service .
As the core API are deprecated, you can find all legacy Groovy services, which use these core API, by running the following script in the Groovy console with the Secure Fluent API Only checkbox unselected.
import com.avoka.fc.core.dao.*
import com.avoka.tm.query.*
import com.avoka.tm.vo.*
List<SvcDef> svcDefs = new SvcDefQuery()
.withCurrentVersion()
.setFetchLimit(50000)
.listValues()
println "all services: " + svcDefs.size()
def legacyServices = svcDefs.collect{ svcDef ->
def svc = DaoFactory.serviceDefinitionDao.getServiceDefinitionForPK(svcDef.id)
return !svc.isFluentApiService() ? svc : null
}.findAll {it && it.getClassnameBeanname().contains("Groovy") }
println "all non fluent services: " + legacyServices.size()
legacyServices.collect { it.serviceName + " >> " + it.serviceType }.each {
println it
}
To create a new Dynamic Data service (Groovy service) from Services menu, you have an option to create this service based on the Fluent Dynamic Data Template (Fluent Groovy service), or Groovy Dynamic Data Template (Groovy service), as shown below.
It is recommended to use Fluent Groovy service.
Next, learn about Transact Fluent SDK.