AnsweredAssumed Answered

How to Configure Activiti Engine In Config file Of Grails Project

Question asked by himabindu.v on May 8, 2018
Latest reply on May 15, 2018 by himabindu.v

1. In Spring i did like this for generating activiti related tables in database

         

@Bean(name = "processEngineConfiguration")
public SpringProcessEngineConfiguration processEngineConfiguration() {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setDataSource(getDataSource());
config.setTransactionManager(getTransactionManager(getSessionFactory()));
config.setDatabaseSchemaUpdate("true");
config.setHistory("audit");
config.setAsyncExecutorActivate(false);
config.setJobExecutorActivate(false);
config.setMailServerHost("smtp.elasticemail.com");
config.setMailServerPort(2525);
config.setMailServerUsername("vamsikrishna.g@nipun.net");
config.setMailServerPassword("de0bc9a4-663c-40ee-8546-4a4c98f4919f");
return config;
}

@Bean(name = "processEngine")
public ProcessEngineFactoryBean processEngine() {
ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
return factoryBean;
}

@Bean
public HistoryService historyService(ProcessEngine processEngine) {
return processEngine.getHistoryService();
}

@Bean
public ManagementService managementService(ProcessEngine processEngine) {
return processEngine.getManagementService();
}

@Bean
public RepositoryService repositoryService(ProcessEngine processEngine) {
return processEngine.getRepositoryService();
}

@Bean
public RuntimeService runtimeService(ProcessEngine processEngine) {
return processEngine.getRuntimeService();
}

@Bean
public TaskService taskService(ProcessEngine processEngine) {
return processEngine.getTaskService();
}

@Bean
public IdentityService identityService(ProcessEngine processEngine) {
return processEngine.getIdentityService();
}

@Bean
public FormService formService(ProcessEngine processEngine) {
return processEngine.getFormService();
}

 

 

2. like this i have to Configure activiti engine in grails

I am added this Code in Config.groovy

activiti {
processEngineName = "activiti-engine-default"
jobExecutorActivate = false
asyncExecutorActivate = false
databaseType = "mysql"
history = "audit"
}

environments {
development {
grails.logging.jul.usebridge = true
activiti {
processEngineName = "activiti-engine-dev"
databaseSchemaUpdate = "true"
}
// grails.serverURL = "http://localhost:8080/MaterialManagement/dashboard/main"
}
production {
grails.logging.jul.usebridge = true
activiti {
processEngineName = "activiti-engine-prod"
databaseSchemaUpdate = false
}
// grails.serverURL = "localhost:8080/smartInventory"
// grails.serverURL = "localhost:8080/MaterialManagement/dashboard/loginpage"
}
}

 

DataSource.groovy

--------------------------------

dataSource {
pooled = true
jmxExport = true
driverClassName = "com.mysql.jdbc.Driver"
dialect="org.hibernate.dialect.MySQL5InnoDBDialect"
username = grailsApplication.metadata['database.username']
// password = "root"
password = grailsApplication.metadata['database.password']
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}

// environment specific settings
environments {
development {
dataSource {
dbCreate = "validate" // one of 'create', 'create-drop', 'update', 'validate', ''
url = grailsApplication.metadata['database.url']
username = grailsApplication.metadata['database.username']
password = grailsApplication.metadata['database.password']
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}

}
test {
dataSource {
dbCreate = "validate" // one of 'create', 'create-drop', 'update', 'validate', ''
url = grailsApplication.metadata['database.url']
username = grailsApplication.metadata['database.username']
// password = "root"
password = grailsApplication.metadata['database.password']
// password = "root"
}
}
production {
dataSource {
dbCreate = "validate" // one of 'create', 'create-drop', 'update', 'validate', ''
url = grailsApplication.metadata['database.url']
username = grailsApplication.metadata['database.username']
// password = "root"
password = grailsApplication.metadata['database.password']
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}

 

I want to Specify DataSource in activiti enginee of config file

i have to generate activiti related tables dynamically in database

 

 

what can i do in grails, could you please let me know how to implement this.

 

 

Thanks&Regards,

V.HimaBindu

Outcomes