Discontinued: How to Use Custom Components in Provisioned IMs (Components Library)

This guide is no longer valid and is kept only for historical reasons.

Starting with IntegrationManager 4.5.0, it is possible to share Java classes in a single library. Here is a brief description and manual on how to use it.

Overview

Components library (complib) is used for sharing a custom logic in the form of Groovy classes across multiple IMs, completely removing the action of copying the same classes between IMs. All classes in Components library are available to all IMs.

To create components for a single IM, use Classes.

Components library does not work in ‘private’ mode. If the policy requires for such components to be private (e.g. partner only), it is advised to use your own solution and share the components with the IM via Maven private server.

Versioning

Starting with IM version 5.0.0, this schema is used:

IM Version

Components Library Version

Note

5.0.0

5.0.0


6.10.0

6.10.0


5.10.1

5.10.0

Complib is not released for hotfixes

5.10.25

5.10.0

Complib is not released for hotfixes

5.0.1

5.0.0

Complib is not released for hotfixes

For older versions, the following schema is used:

IM Version

Components Library Version

Note

4.10.15

1.5.0_over_4.10.0

Complib is not released for hotfixes

4.10.1

1.5.0_over_4.10.0

Complib is not released for hotfixes

4.10.0

1.5.0_over_4.10.0


4.5.0

1.4.0_over_4.5.0


How to Use Components in IM

The usage depends on whether it is used in a manual or provisioned IM.

Step

Manual IM

Provisioned IM

  1. Required dependency

Add to pom.xml:

<dependency>
  <groupId>net.pricefx.integration</groupId>
  <artifactId>im-components-library-component</artifactId>
  <version>5.0.0</version> <!-- this is to be updated on IM update -->
</dependency>

Where the version follows the above schema.

Skip, it is automatically set.

  1. Required properties

Add the following property:

integration.component.library.enabled=true

Skip, it is automatically set.

  1. Component exists

Assuming the following component is present in the Components library:

Groovy
package net.pricefx.integration.library.component.processor;

import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;


@Slf4j
public class DebugBreakpointProcessor implements Processor {
    @SuppressWarnings("unused")
    @Override
    public void process(Exchange exchange) {
        Object body = exchange.getIn().getBody();
        log.info("Debug");
        int i=0;
    }
}


Assuming the following component is present in the Components library:

Groovy
package net.pricefx.integration.library.component.processor;

import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;


@Slf4j
public class DebugBreakpointProcessor implements Processor {
    @SuppressWarnings("unused")
    @Override
    public void process(Exchange exchange) {
        Object body = exchange.getIn().getBody();
        log.info("Debug");
        int i=0;
    }
}


  1. Declare component usage

Add the following code to the camel-context.xml file:

XML
<bean id="debugBreakpointProcessor"  class="net.pricefx.integration.library.component.processor.DebugBreakpointProcessor"/>


Create a new file debugBreakpointProcessor.xml in the beans folder with the following code:

XML
<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:pfx="http://www.pricefx.eu/schema/pfx"
		xmlns:util="http://www.springframework.org/schema/util"
		xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
		http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
		http://www.pricefx.eu/schema/pfx http://www.pricefx.eu/schema/pfx.xsd">
	

  <bean id="debugBreakpointProcessor"  class="net.pricefx.integration.library.component.processor.DebugBreakpointProcessor"/>
</beans>


  1. Use component

In a route, use: <processor ref="debugBreakpointProcessor"/>

How to Check Existing Components

  1. Go to https://gitlab.pricefx.eu/im/services/im-components-library/-/branches.

  2. Pick a correct branch according to the IM version with the following schema: release/VERSION

  3. Go to component/src/main/java and package net.pricefx.integration.library.component.

How to Develop New Component

  1. Update to the currently supported IM version (= latest release or latest LTS).

  2. Locate the correct release branch in the Components library, e.g. release/5.0.0.

  3. Create a feature branch over the release branch., e.g. feature/myNewComponent from release/5.0.0.

  4. Create a component with tests and push it to Git.

  5. Create a merge request to the origin branch, e.g. feature/myNewComponentrelease/5.0.0.

  6. Create a merge request to the develop branch, e.g. feature/myNewComponentdevelop.

  7. Request an approval from IM team for both merge requests.

  8. Once merged, you can start using your component.