I am new to Activiti and I am very interested to master it I have the following problem. I am writing application that uses Spring container however not all my classes are Spring beans - part of them are just simple classes. I need the Activity runtimeService in both cases. My solution is that I have two configurations one for spring with annotations and second one which points to the same database in activity.cfg.xml. My question is will it cause any troubles? For example is runtimeService the same in both cases?
You'll have 2 different engines created: one booted by the spring-container and one standalone. You'll have 2 separate datasources (each taking up X number of connections, in the worst case) and 2 job-executors who will be competing to execute jobs (which may lead to a tiny bit of overhead when doing optimistic locking).
Hence, you'll have 2 different instances of runtimeService - any difference in configuration *could* cause issues when engine 1 reads processes started by engine 2. Can't you create an additional bean that is AplicationContextAware (and perhaps listens for ApplicationContextEvents) which extract the process-engine from the spring-context and exposes this though a thread-local or static field?
Which reminds me, the ProcessEngines class does exactly what you need. When spring boots the engine, it will be registered with the ProcessEngines object, available for non-spring aware services to fetch it in a static way…