Skip to main content
May 26, 2021
Question

Handling Asynchronous calls from Appian

  • May 26, 2021
  • 6 replies
  • 1 view

Hi, 

For handling asynchronous calls from Appian, I have analyzed below approaches. Can you pls advise which approach would be suitable for below scenario? If you have any better solution, kindly let me know.

Thank you in advance.

Design summary:

1- Orchestration is carried out in Appian process model. There are three external APIs (Say A, B and C) that need to be invoked from Appian.

2- After calling API-A, Appian will hold the process flow

3- Once Appian receives response for API-A asynchronously, then it should move on next step

4- Same pattern follows for API- B and API-C

 We have following solutions to accomplish this Asynchronous communication pattern.

Solution-1:

  • After invoking API-A at step#1 , flow moves to User input task to hold the process at Step#2
  • Response payload for the above call will be published to KAFKA topic at Step#3 from upstream system ( system for API A)
  • Custom message listener ( JAVA based component ) will pick the response message from KAFKA topic at step#4 and will call Appian exposed API over http at step#5
  • Once Appian receives the response payload from step#5, it will retrieve active task Id using process ID using Appian inbuilt function (getactivetaskidsforprocess())to close the User input task at step#6
  • Appian flow will move on to next step at step#7
  • This pattern will continue for API-B & API-C

Disadvantage:

  • Appian function getactivetaskidsforprocess() may return multiple active task Ids for a process instance. Identifying the task id for the user input task and completing it would be difficult.
  • This approach is a workaround solution to implement Asynchronous communication. User input tasks is used for any human intervention but here this activity is used to hold process flow

Solution-2:

  • After invoking API-A at step#1, flow moves to Receive message event to hold the process flow at Step#2
  • Response payload for the above call will be published to KAFKA topic from upstream system (system for API A) at Step#3
  • Custom message listener (JAVA based component) will pick the response message from KAFKA topic at step# 4 and will call Appian exposed API via http at step#5
  • Once Appian receives the response payload from step#5, it will send the response to receive message event through send message event step# 6 to release the process
  • Appian flow will move on to next step at step#7

 Disadvantage:

  • Receive message events listen/poll for messages continuously which occupies the memory all the time and this eventually has impact on performance. This behavior can potentially cause slowness.
  • There is no other way to create separate queue for managing send receive event 

 Solution-3:

 

  • After invoking API-A at step#1, flow moves to Receive message event to hold the process flow at step#2
  • Upstream system which hosts the APIs will invoke receive message event directly to release the flow at step#3
  • Flow moves on to next step at step#4

 

Disadvantage:

 This approach is tightly coupled and P2P communication.

    6 replies

    stefanhelzle0001
    Brainy
    May 26, 2021

    My suggestion is to not have any active process waiting. Why not send out the message, persist some state in DB and start the next process phase as the result comes in?

    You will probably want to implement some house keeping to find "processes" waiting for a result for too long.

    May 27, 2021

    [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] Thanks for your reply, but in our use case we cannot go with the approach you mentioned i.e. using db and instead we need to handle in the process itself.

    we want to hold process flow and move to next task/activity once Appian gets the response from webapi asynchronously.

    Can you please let us know if any of the above approaches mentioned by [mention:0605253b3b7b43d8985e38634d2a05e6:e9ed411860ed4f2ba0265705b8793d05] is a better solution or do we have any other idea implementing. 

    Appreciate your help. 

    stefanhelzle0001
    Brainy
    May 27, 2021

    What is the reason for not going the proposed way?

    About how many process instances are we talking? Depending on that one or the other solution might be better.