Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Disclaimer: The content provided in this series is formatted as a step-by-step narrative to provide a prescriptive sequence for a common customization. Since your implementation will undoubtedly be different than shown here, everyone should consider this as a conceptual guideline to resolve a custom requirement.

Description

In this scenario, we will illustrate the customization of the generated code from the IM template through the use of a custom POJO bean. This scenario will involve extracting data from a Product Extension table, filtering it and then performing some data transformation.

 In our new scenario, we have these distinct customizations

  • Extract data from Pricefx partition

  • Utilization of the Pricefx API for data extraction

  • Perform filter operation during data extraction

  • Modification of the data during extraction

List of steps to complete this process:

Table of Contents

Prerequisites

In order to be able to complete this exercise, we will need the following prerequisites before proceeding.

  • PlatformManager access

  • Existing IM instance

  • Access privileges for:

    • Partition creation

    • Git repository access

    • Pricefx Maven repository

  • Partition Connection

  • SFTP Connection

  • One functioning Route

  • WinSCP FTP Client or equivalent

  • Cloned IntelliJ project

Step 1: Connect to IM Instance

Prior to local development and customization, we will need to follow the path from the IM instance within PlatformManager to the Git repository that contains the contents of our integration project. Our goal will be to open the Git repository linked to our IM instance.

  1. Go to platform.pricefx.com and choose the Login with O365 option:

2. Click on the Integrations option (left-hand side):

3. From the list of integration instances, create a filter to locate your IM instance:

4. Locate your IM instance and click on it, this will open the IM instance page:

On the left-hand navigation, we will see all options related to this instance:

Info

NOTE: We have selected our single IM instance and all of this options (Routes, Mappers, Connections, etc.) are reflective of this single instance.

5. Next, we will open the Git repository linked to this IM instance:

Info

NOTE: The creation of IM instance will automatically build a corresponding Git repository that will then contain all of the generated elements that are linked to this instance.

6. Click on the Git repository link to open the Git project:

Examine what is provided, click on the src/main folder.

Step 2: Clone to Local

Our objective in this step is to customize the generated XML and Json code associated with our IM instance and the first step in that process is to clone this project to our local machine.

  1. Click on the Clone option:

2. Next, click on the Copy URL option to copy the URL path.

3. Then, we will open IntelliJ and use the File | New | Project from Version Control to connect to our remote Git repository:

4. Next, this will display the Get from Version Control panel and we will paste the URL path:

Click on the Clone button.

6. The project has now been cloned to our local machine and this local instance is connected to our remote repository in gitlab.pricefx.eu.

7. Next, we need to switch to the dev branch within Git and in that branch we will perform all of our updates and modifications to the code. In the lower right-hand corner we can select the remote dev branch:

Then we will choose the Checkout option.

8. Next, lets verify that we have successfully cloned the dev branch from the remote repository to our local machines. So, within Intellij lets open folder path of src/resources/repo and it will appear as:

9. Next, open the Connections folder to view our connection files:

10. As an example, we can open one of the connection Json files. It will appear as:

11. Next, open the Routes folder to view our route files:

12. It does appear that we have successfully cloned our IM instance Git project to our local machine. We can verify this by comparing the Git folders in src/main/resources/repo to those in Git:

 

 

Step 3: Password Updates

Before we can run our integration processes locally, we will need to update the encrypted passwords with actual clear text passwords.

1. First, we will need to locate the connections being used by our integration instance. Open the folder path

src/main/resources/repo/connections:

2. There are two different types of connection files that will need to be updated. One for the SFTP connection and the other for the partition.

3. When we open our connection JSON file we should find an encrypted password:

4. We will need to update the connection passwords with the clear text versions that were provided (via email) when the integration instance was created.

Step 4: Start Local Application

After the updates to our connections, we can start the local process via IntelliJ that will allow us to execute our routes through our local machine.

  1. First, open the folder main/java/pricefx and locate the LocalAppRunner application:

Image Added

2. Open the LocalAppRunner file:

Image Added
Info

NOTE: This is a Spring Boot application runnning within a Tomcat instance that is then running on our local machines and connecting to our partition and SFTP instance and folders.

3. Prior to launching our local instance, we will need to ensure that any Routes connected to this IM instance have been stopped. Go to Routes for our IM instance:

Image Added

We should verify that the Status for our routes has been changed to Stopped:

Image Added

4. Next, we will launch the LocalAppRunner application. Right click on LocalAppRunner and choose the Run option:

Image Added
Info

NOTE: This is a Spring Boot application running within a Tomcat instance that is then running on our local machines and connecting to our partition and SFTP instance and folders.

5. In the log file, we are looking for the messages related to the successful launch of any routes that are linked to the IM instance:

Image Added
Info

NOTE: The local instance of the IM instance is now ready for route executions and we will be able to watch the route execution via the log entries.

Step 5: Route Modification

We will be making changes to an existing route to perform our data extraction and the following are the steps that we will be employing.

  1. First, since we are doing a data extraction, we will want to limit the number of times that this process will be executed. Thus, after opening our route:

Image Added

2. Then, we will add the following time limitation to our <from> tag:

Code Block
languagexml
<from uri="time://fetchData?repeatCount=1"/>
Info

NOTE: We can use Camel’s timer component to schedule tasks to occur either at a specified time or at regular intervals. This Timer component is deployed as a core feature of Camel. It generates events which in turn trigger the endpoint that follows and generate messages. It uses uses the JRE’s built-in timer mechanism to generate message exchanges at regular intervals.