Thursday, July 11, 2024

Oracle Integration Gen2 PCS to Gen3 OPA Upgrade: Part 3

In a short series of articles, I will discussed some challenges you may face when upgrading Oracle Integration Gen2 (OIC 2) Process (PCS) to Gen3 (OIC 3) Oracle Process Automation (OPA) applications. In this episode 3 I discuss the tasks API challenges. The previous article can be found here

Disclaimer: The below provides a snapshot at the time of writing. Things may have changed by the time you read it. It is also important to mention that this does not necessarily represent the view of Oracle.

Note: this article has changed on 2024-07-15 by adding the below references.

Specifically for PCS to OPA migration you are also referred to the following:

If you are using any of the Oracle Integration Process Gen2 (called PCS from here on) API’s in your application, than you need to refactor this when going from PCS to OPA.

Firstly, none of OPA API's have the same endpoint as the PCS’s have. The PCS API's start with /ic/api/process/v1 whereas the OPA API's start with /process/api/v1.

To be honest, I have not checked it in detail, but I suspect that only for Dynamic Process the interface (method and request/response) might still be the same if the functionality is still supported. For Structured Process also the interface has changed, so any call to a design or runtime API you may be using in the application must be refactored.

When you have some home-grown CI/CD solution that relies on OIC API's you are in for quite some work to refactor. The same for any custom utility. For example, I have built a utility integration to deactivate a set of activated process application versions in a certain range. Will no longer work for OPA. This article is not covering any of this type of non-runtime related topics, as this series is restricted to PCS to OPA process application upgrade / migration challenges.

Finally, another important change is that (in contrast to PCS), OPA only supports OAuth 2.0 token based authentication (see also OPA Security, Authorization and Authentication). 

Normally there are just a few API's used to run a process application and only in a few places, if any. But if you do the typical API’s are:

  • The tasks API
  • The process instances API

In this article I discuss the tasks API. Next time I will handle the process instances API.

Process Task API

The most common use cases are:

  • Get and filter tasks for a user
  • Perform action on a task:
    • Submit
    • Claim
    • Reassign

Get User Tasks

Most common PCS usage to get all tasks for a user

    GET /ic/api/process/v1/tasks?assignment=MY_AND_GROUP

For OPA this will become

    GET /process/api/v1/tasks?assignment=MY_AND_GROUP

Regarding the request, only the endpoint is different, but the response is significantly different. The next table points out a few differences to consider.

As you can see the assignment filter MY or GROUP is the same for PCS and OPA. However, in case of OPA the assignment filters ALL, ADMIN, OWNER (and a few others) are no longer available. Instead, you probably want to use PERSONA (fetches tasks where logged-in user has access to this task due to application permissions).

The typical use case for a user to filter tasks is by title containing some string. For PCS to filter all tasks with "Jack" in the title you would use:

    GET on /ic/api/process/v1/tasks?assignment=MY_AND_GROUP&keyword=Jack

This would find tasks with "Jack" in the "title", "shortSummary" or "identificationKey".

For OPA there is no "keyword" query parameter that searches over multiple elements. Instead, you now search on a specific element, typically (but not restricted to) "title", "titleLike", "summary", "summaryLike", "businessKey", "businessKeyLike". 

So, in case of OPA you would use:

    GET on /process/api/v1/tasks?assignment=MY_AND_GROUP&titleLike=Jack

Note that, when using more than one of these query parameters, it uses AND (and not OR). So, for a PCS custom task list where people are used to be able to search on a substring being present in any of "title", "shortSummary" or "identificationKey", than that is no longer supported.

See also OPA List Tasks API.

Perform Action on Task

For PCS to perform any action on a task you use

    PUT on /ic/api/process/v1/tasks/:id 

This includes submit, claim, reassign and withdraw.

In case of PCS the :id to use is actually the “number” as is returned by task list response, for example 206294. 

In contrast, for OPA you use the “id” (also already present in PCS) which is a string and much longer, for example "7a056b84-3df2-11ef-9e7b-12bc3458bb6a". 

For use cases where you pass back the task id as a reference for some front-end application or store it in a database, this probably implies you must make a change to be able to persist it.

To submit a PCS task you can use a payload like this:

{
    "action": {
        "id": "APPROVE"
    }
}


To reassign you would use the same API and a payload like this:

{
    "identities": [ {
        "id":"john.doe@oracle.com","type":"user"
    } ],
    "action": {
        "id":"REASSIGN", "type":"USER"
    }
}

To claim you would use "ACQUIRE" as action id, to withdraw "WITHDRAW" etc.

In case of OPA the action is not in the payload, but a verb in the URI (which previously on restfulapi.net was called a “resource controller” but funny enough appears to have been replaced by a pattern that puts the verb as an "action" element in the request instead, just like PCS had 😂).

For example to submit an OPA task you use:

    POST on /process/api/v1/tasks/:id/complete

With the outcome in the payload, like:

{
  "outcome": "APPROVE"
}

Likewise, to claim a task:

    POST on /process/api/v1/tasks/:id/claim 

With optional comment in the payload.

To reassign a task:

    POST on /process/api/v1/tasks/:id/reassign 

With the user to assign to in the payload, like:

{
  "identities": [
    {
      "id": "b4d83a44319a4edf97be9fc4a242c107",
      "type": "USER"
    }
  ]
}


To withdraw a task:

    POST on /process/api/v1/tasks/:id/withdraw

With optional “comment” and “isWithdrawChild” flag in the payload.


Previous articles on the subject:

 

Friday, June 28, 2024

Oracle Integration Gen2 PCS to Gen3 OPA Upgrade: Part 2

In a short series of articles, I will discussed some challenges you may face when upgrading Oracle Integration Gen2 (OIC 2) Process (PCS) to Gen3 (OIC 3) Oracle Process Automation (OPA) applications. In this episode 2 I discuss the Multiple Start event and synchronous Process start challenges. The previous article can be found here

Disclaimer: The below provides a snapshot at the time of writing. Things may have changed by the time you read it. It is also important to mention that this does not necessarily represent the view of Oracle. 

Note: this article has changed on 2024-07-12 by adding a 4th option to the Synchronous Process Start - Remedy.

Note: this article has changed on 2024-07-15 by adding the below references.

Specifically for PCS to OPA migration you are also referred to the following:


Multiple Start Events

On OIC 2 you might have created a process that can be started via multiple start events. A use case for this would be a process that can be started by a form as well as a message, both with a slight different interface. For example the request of one might take a bit more data, while for the other that data is defaulted.

In the following sample user registration process, the one flow that is started by a Form first needs to determine a user id before it can store the user data. The other flow that is started by a message (from some other application), already has the id but does not provide some user details. So, the new user is asked by mail to complete those details, the user enters those, after which the data is stored.

 

The Challenge

Currently OPA does not support having multiple Start Events for the same Process. As far as I know this is on the roadmap, but currently not there.

When the above process is imported in OPA, it will show you an error.


 

The Remedy

As a matter of fact, a Form Start can also be started via a message. Therefore, there are 2 options:

  1. Create a separate, new Process in the same application with a Message Start event that exposes an interface that is the same or backward compatible with the exiting one, and then remove that existing one from the Process that is having both Start events. On its turn this new Process can start the other Process with the Form Start event using a Send activity of type "Process call".
  2. Create a new Process in the same application with a Form Start event that exposes the same or backward compatible interface as the existing one, etc. When the Process is started via the out-of-the-box Webform feature from the out-of-the-box Workspace, this has no impact. In case of a UI implemented with some other technology (like VBCS) that UI application will have to be changed to call the new Form Start interface.

In this case I chose to create a new process with a Message Start and let that call the one with the Form Start. The rationale to keep the Form Start in the main process is to keep it simple, as the only thing I had to do is adding an (optional) user id element to the interface of the Form Start (which did not have before but as it is optional the interface is backward compatible) and then add a condition to the Form Start flow to skip the step for determining the user id.

So, the new Message Start flow looks like this:


And the Form Start looks like this:


Obviously having to call another Message Start process is a breaking change, but is the case anyway as the OPA API is different from the PCS API (see also the previous blog article in this series).


Synchronous Process Start

On OIC 2 you can start a Process in a synchronous way when using it's SOAP webservice (see also previous blog article). A use case for this is that the process instance needs to pass back some information or raise a fault. For example, you might want the instance to do some validation and throw a fault when that fails or otherwise pass back the processId.

In the following example (from a real application) an integration is called to fetch data that is used downstream. If nothing can be found, with the Get Subsidy Failed an error is thrown as a Business Exception that the consumer can catch to handle it. Otherwise, with the Send Response a response is returned with the process instance id.

 

The Challenge

OPA does not have the option to return a custom response or fault from the process flow. The OPA /process/api/v1/instances API to start an instance returns the instance id, but if the process would fail right after the start, the consumer would not know.

The Remedy

Depending on the options on the consumer side you have one of 4 options:

  1. Move the logic necessary for the response or to raise a fault, to an Integration instead. In my example, there is already such an Integration, as I always decouple the process from the consumer (to supports that some changes can be made without any impact on the consumer). So, in may case I can check the existence of the business object that with PCS happened at the beginning of the process flow, to the existing Integration.
  2. The consumer waits for a short while before it uses the OPA /instances/:id API to check if the process runs successfully.
  3. The process writes the status and optional response to a database and the consumer polls that database.
  4. The process does a call back of some sort to send the status or response to the consumer.


Next episode on this topic Part 3 Tasks API.

Previous episode on this topic: