Skip to Content
Technical Articles

How to reuse existing mapping, schema and most importantly scripts from other Integration flows in new Integration Flow.

Introduction : 

In lots of projects I have noticed multiple interfaces require a to use same schema , mapping and scripts. Scripts are something which should be written only once and should be reused across different interfaces if needed. For example logging payload or exception script which  are used mostly. You dont need to write or copy same code again and again.

CPI has feature to reuse the Archive scripts , mapping and schema which you can get from local file system and other Integration flow. There is option to reuse mapping from ESR as well.

 

Step1 : Create a new Package or use existing Package.

Step 2: Create an Iflow, go to Resources Tab->

 

Step 3: Click on Add-> Archive/Schema/Mapping/Script from Local File System or existing Integration Flow form another package.

 

 

  1. If you want to Add Schema -> XSD /WSDL EDMX (Any type)

 

 

2. Add Mapping-> MM/OM/XSLT mapping from Local/ESR/Integration Flow

 

 

 

3. Add Script-> File System/ Integration Flow

4. There is option add Archive as well.

Conclusion

Reusing already build scripts will save you lot of build time. You can write few standard scripts at the beginning of the project and can use those across all interfaces.

Hope this will help you in reusing your existing components.

2 Comments
You must be Logged on to comment or reply to a post.
  • The issue I was trying to solve was that two of the Integration Flows that I have require the same value in the header (it is read from Security Material).  So rather than duplicating the groovy script code between the Integration Flows, I wanted to have only one groovy script that I could update, and the changes would be reflected in each of the Integration Flows.

    This does not seem to be the way that this works with Resources.  From my testing, it looks like the steps above COPY the script to the new integration flow rather than link back to the original.

    Here are the steps I took:

    1. I added a script to the resources of one Integration Flow as described above. I uploaded the script from a file for this first step.
    2. I created a new Integration Flow, and added the script from step 1 by choosing the source – Integration Flow
    3. I updated the original script from step 1

    What I expected was that the script in Step 2 would be updated since it was linked to the script in step 1.  This does not appear to be the case.  When I made changes to the original script, they are not seen in the second Integration Flow.

    From what I have found, this does not seem like reuse, but instead is a copy the original to each subsequent Integration Flow, and the scripts remain independent.

    So is this something that I have done incorrectly, or does the reuse as shown in the original post not work the way I thought it would?

    Thanks.