Monday, November 11, 2024

#1037 - OIC Integration Basics - Lab 8 More Actions














Introduction

The post covers the remaining Actions you can leverage, when creating your integrations.

Error handling

I covered error handling in an earlier lab, but just to recap - OIC integrations each have a Global Fault handler, to which you can add Scope fault handlers.

The default action of the global fault handler is just to rethrow the fault - we saw this in the createOrder example, where the ORCL DB adapter was used to insert an order into a database. I generated a Primary Key error in the DB, by tying to insert an order with a duplicate order number. The Global Fault hander, did it's work and delivered the fault received from the adapter, back to the client. We also met Throw new fault, when the scope error handler handled the adapter error received from the DB and created a new app specific error, along with a more user friendly error message.  








Logic

For each

This used for processing iterators e.g. an order with multiple order lines. We've met this action before - 

Noe how this is configured - you specify the repeating element, in our case, the order lines. You then give a name for the current item e.g. currentLine.













Parallel

This allows one to process items in parallel e.g. an incoming order needs to undergo 2 checks - legal check and credit check. Each of these checks is implemented in a separate integration. From a business perspective, these checks can be done independently of each other, so we can use the parallel action here.

Scope

We have already used the Scope action in our order processing example.

Scopes allow us to organize related actions together, they can be collapsed, thus making our diagrams more readable. They can also be used to process faults thrown by actions within the scope itself.

 
Scopes know what they are invoking and know what type of errors the target apps can throw. Default error handlers are available for these. Here's a simple example where I use the Fusion adapter to get account details - 

Switch

If/Else processing - 

As you can see, I can add more route nodes as well as define the "else" path - 

While

this enables the execution of a loop, while a condition is still met. Let's go back to our order lines example - 

My request payload contains an order with 2 order lines.

I create the following variables at the start of the orchestration - 

I then configure the While action - 
  
Note how I use the number function here.

The While logic is banal -

I now activate and run - 

Call

The call actions allow you to call other services -

File Server

OIC comes with it's own sftp conform file server and this action makes it very easy for you to interact with it. You could, of course, use the OIC FTP adapter to do this, but why make more work for yourself? Some setup is required for this to work, that is discussed in a previous post.

Let's check out which folders I have - 
Back to my integration, so we can try out the file server action - 

Note the minimum age setting, setting this can help you avoid picking up large file, before they have been fully written to the file server.

I hardcoded the input directory above, however, this can also be set via the map action -

Notice the ability above to Process items in parallel.

I add the file server action again in the For Each - 
























Let's see what we can do here -

Write File - allows us to write the file to another file server folder.

Move File - move file from folder A to B.

Get File Reference - allows us to get a reference to the file, in order to be able to read it and process it further.

Delete File - now I wonder what this does.

Target and Source - 

I activate and run the integration -

I will go into more detail about this action and how it works with the Stage File action in a future post in this series.

Integration 

The Integration action allows us to call an integration e.g. integration A processOrder calls integration B shipOrder. These calls are internal, i.e. they do not go outside of OIC. Which integrations you can call is dependent on the following - 

1. you can call integrations within the same project
2. you can call integrations from other projects that have been created as shareable
3. you can call integrations that are in the global space, i.e. not part of a project.

By global space, I mean integrations created via - 

However, we do strongly advise you to use Projects for your integrations.

JavaScript

We have covered this action already, suffice to say - import your JS libraries into your project and then invoke their functions via this action.













OCI Function

Akin to Lambda on AWS, functions can be used to externalise complex business logic.

OCI Object Storage

Object Storage can be used for a variety of purposes e.g. as  inexpensive long-term storage for documents etc.

Think of Buckets as directories and objects as docs you store in that directory. Naturally, you can store anything in a bucket.

Publish Event

Another action we have already met in the post that covered OIC Events. 


End

Stop

Concludes a fire and forget (async) integration. The work is done, so stop.

Return

This is the default action generated at the end of a synchronous integration.






 














  

  

No comments:

Post a Comment