Talk to external database

Hi,

I want to do some operations with external database (not one that is being used by flowable-task already…!) from the service task (i.e JavaDelegate class). how can I achieve it ?

Thanks.

Hi,

You can include a service task in your process model and set your JavaDelegate class as class attribute. Then it will be executed as part of the process instance.

Best regards,

Tijs

Hi Tijs,

Actually I want to declare another Datasource, so that I can communicate to the external database from this JavaDelegate class of my service task. So the questions are…

  1. How to define new datasource on application level, (i.e Bean) in Flowbale-Task application ?
  2. How to get that datasource into my JavaDelegate class to create JdbcTemplate or HibernateTemplate ?
1 Like

Hi,

Ah ok. You can create another DatabaseConfiguration and add it to the .conf package. Then you need to make sure the right data source is injected in the FlowableEngineConfiguration and in your JavaDelegate. Your JavaDelegate needs to be an expression or delegate expression so that it’s retrieved from teh Spring application context with autowiring of the data source. Be aware that if you need the transaction of the second data source to run in the same transaction as the Flowable Engine, that you will need JTA transactions.

Best regards,

Tijs