Requiment: Calling another system API from flowable Process flow

Hi All,

I have requirement to call another API frm flow:
Requirement: Calling another system API from flowable Process flow. which task i should use from flowable modeler??

And i have another requirement to invoke DB SQL of another system , and for this requirement which is the best way to achieve??

waiting for the response!
Thanks in advance!

-Santosh

This depends on what kind of an API you are interacting with:

  • REST APIs typically use HTTP tasks
  • Java API’s usually use a Service task. You’d also use a Service task if you were interacting with JMS or AMQP messaging.
  • I’ve never used them, but we also have the Camel and Mule tasks.

What follows is more about Domain Driven Design than Flowable:
As far as the requirement to “invoke another system’s DB”, the cleanest way would be to set up endpoints on the other system and invoke those. This way your Flowable implementation does not cause undocumented requirements to the other system by restricting their freedom to change their data model. These endpoints could be accessed by REST or messaging utilizing the HTTP and Service tasks respectively.

Sometimes you are not allowed to modify the other system and you have to access its database directly. In that case you should implement an anti-corruption layer to try to insulate changes in the other system’s data model from the new system’s domain model.

Will

Thanks wwit for the Update.

In my scenario i have JAVA API\SOAP API, as per your comments i think Service Task is the correct choice.

And i have scenario only reading data from the another system DB, where changing data model in other system is not involved.

As per your suggestion what is the best way to call pure SQL statement to read data from DB?
I am thinking like below,
Have a service Task, then implement Class to setup Data connection and execute Query and read data.

I am little curious to know more on Camel Task, and in which scenario these can be used. If you have any idea please do add your comments.

Many Thanks!

If you are using Spring, adding a second datasource and using JDBC templates or JPA repositories would be my preferred way of accessing directly accessing the database. the repositories or JDBC templates would be used in @Service beans to query, process, and return the data using the domain model needed for your Flowable app. The service beans can be @Autowired into the JavaDelegates.

Always using the service beans to access the data from inside your Flowable app means there is always a single place to change when you need to translate between your domain model and the other system’s data model.

Thank you wwitt for the update.

Since i am new to Flowable , i would be asking another query related to this. I would be great if you can add your comments.

As a extension of this requirement: Whatever queried data from Database I would like show it in UI(UI form can be custom UI page but not created based on the FORM option in flowable).

What is the besy way to render the page based on the DB output to show it in UI?

Is there any specific configuration\logic needed in Flowable process definitions?

And how to read data (DB Output) in UI to show it to user?

Thanks in advance!

-Santosh

Hi wwitt,

It would be great if you can add your comments.

Thanks in Advance!

-Santosh

When the data comes back, you can store it as a variable or variables in the process. From there you can do what you’d like with it. The variables are immediately available to forms so they could be displayed there or you can create your own UI using whatever technology you’d like.

Will

Thank you wwitt for the update.

Here you meant Variable in JavaDelegate class if i am implementing service task?

Lets say I have service Task in process flow , from there Javadelegate Class is invoked, and in Javadelegate class there is a logic to pull data from DB.
In this scenario Variables created in Javadelegate class are directly accessible to Forms? Or there should be Process Variable created in Process and fetch variable data from Javadelegate class into process variable. And from process variable use it for UI for displaying?

Can you please add your comments?

Also you can add link if any sample flowable example is available around this scenario.

Thanks in advance!

Santosh

Sorry if I was unclear. You can store the data returned from the query as a process variable so that it can be used in subsequent tasks like displaying on a form, executing a decision table, etc.

Thank you wwitt for the update.

To Create process variable in service Task, what are the options? Atleast i didnt get any options except Form variables in Start Event.

Lets Assume: ‘QueryOutput’ data present in Javadelegate clas after fetching data from DB.

for this where can I create process Variable to store in process definition?

If you can point to any sample code snippet also fine.

Thanks in Advance!