Camel Transport Adapter

The Camel Transport Adapter is available starting from version 6.16.0 of FIXEdge C++.

Overview

This document provides an introduction to the Apache Camel Transport Adapter (Camel TA) for FixEdge and outlines the general steps involved in its configuration.

FixEdge C++ integrates Camel TA to enhance its capabilities for data exchange with various external systems. Camel, an open-source integration framework, simplifies the process of connecting diverse systems that consume or produce data.

Use Cases

The main purpose of the Camel TA is to leverage Apache Camel's endpoints and EIP approach to extend FIXEdge functionality. For example:

Users can also configure other Camel components from the component list that are suitable for their ecosystem and business needs.

Configuration

Given that FIXEdge has already been installed in the user's environment, use the following steps to step up the Camel TA:

Windows

  1. Enable Camel TA in the `FIXEdge1/conf/FIXEdge.properties` using an example in the `camel-ta-distribution/doc/example-windows.properties`:

    ## Copy this example to FIXEdge.properties #------------------------------------------------------------ # Transport Layer Section #------------------------------------------------------------ TransportLayer.TransportAdapters = TransportLayer.CamelTA TransportLayer.JVMOptionsFile = FIXEdge1/conf/camel-ta-distribution/etc/JVM_Options_windows.jvmopts #------------------------------------------------------------ # CamelTA configuration #------------------------------------------------------------ # Adaptor's name. Property is required TransportLayer.CamelTA.Description = Camel Routes Adapter TransportLayer.CamelTA.Type = DLL TransportLayer.CamelTA.DllName = bin/UniversalTADll-MD-x64.dll TransportLayer.CamelTA.ClientNames = CamelSession1,CamelSession2 TransportLayer.CamelTA.Client.CamelSession1.Version = FIX44 TransportLayer.CamelTA.Client.CamelSession2.Version = FIX44 TransportLayer.CamelTA.JavaClass = com.epam.feta.impl.CamelTA TransportLayer.CamelTA.RoutesFile = ../FIXEdge1/conf/camel-ta-distribution/etc/routes.groovy

     

  2. Edit routes in the `camel-ta-distribution/etc/routes.groovy`. See the examples below for reference.

Linux (installed via .rpm)

  1. Get the FIXEdge package from Artifactory / Clientspace.

  2. Copy the `camel-ta-distribution/lib` to the `/usr/lib64/fixedge/${FE_VERSION}/camel-ta`.

  3. Copy the `camel-ta-distribution/etc` to the `/etc/fixedge/camel-ta`.

  4. Enable Camel TA in the `/etc/fixedge/FIXEdge.properties` using an example in the `camel-ta-distribution/doc/example-linux.properties`:

    ## Copy this example to FIXEdge.properties TransportLayer.TransportAdapters = TransportLayer.CamelTA TransportLayer.JVMOptionsFile = /etc/fixedge/camel-ta/JVM_Options.jvmopts #------------------------------------------------------------ # Camel Adaptor configuration #------------------------------------------------------------ TransportLayer.CamelTA.DllName = /usr/lib64/fixedge/${FE_VERSION}/libUniversalTADll.so TransportLayer.CamelTA.Description = Camel Routes Adapter TransportLayer.CamelTA.JavaClass = com.epam.feta.impl.CamelTA TransportLayer.CamelTA.ClientNames = CamelSession1,CamelSession2 TransportLayer.CamelTA.Client.CamelSession1.Version = FIX44 TransportLayer.CamelTA.Client.CamelSession2.Version = FIX44 TransportLayer.CamelTA.RoutesFile = /etc/fixedge/camel-ta/routes.groovy

     

  5. Edit routes in `/etc/fixedge/camel-ta/routes.groovy`. See the examples below for reference.

Examples of Camel TA Configuration

Clients can also find these examples of Camel TA configuration in the /etc/fixedge/camel-ta-distribution directory of the FIXEdge standard installation.

Example 1

This sample will aggregate incoming messages into batches and propagate them to the RabbitMQ topic:

import org.apache.camel.processor.aggregate.GroupedBodyAggregationStrategy; rule. from("fixedge:toBatchSample"). process("unwrapFixedgePayload"). aggregate(new GroupedBodyAggregationStrategy()).constant(true). completionSize(20). completionTimeout(5000). process("listToString"). to("rabbitmq://localhost/fix-in?exchangeType=direct&queue=poc-from-fixedge&autoDelete=false&username=rabbit&password=rabbitpassword"); /* == FIXEdge.properties == TransportLayer.JVMOptionsFile = /etc/fixedge/camel-ta/JVM_Options.jvmopts TransportLayer.TransportAdapters = TransportLayer.CamelTA TransportLayer.CamelTA.DllName = /usr/lib64/fixedge/${FE_VERSION}/libUniversalTADll.so TransportLayer.CamelTA.Description = Camel Routes Adapter TransportLayer.CamelTA.JavaClass = com.epam.feta.impl.CamelTA TransportLayer.CamelTA.ClientNames = toBatchSample TransportLayer.CamelTA.Client.toBatchSample.Version = FIX44 TransportLayer.CamelTA.RoutesFile = /etc/fixedge/camel-ta/routes.aggregate.groovy == BL_Config.xml == <?xml version="1.0" encoding="UTF-8"?> <FIXEdge> <BusinessLayer> <DllHandlers> <Handler Name="JSONMapping" DllName="libJSONMappingHandler.so" Description="JSONMapping Handler" /> </DllHandlers> <Rule> <Source Name="FE-SC"/> <Action> <HandlerAction Name="JSONMapping" Direction="FIX-to-JSON" IncludeCustomTags="true"/> <Send Name="toBatchSample"/> </Action> </Rule> </BusinessLayer> </FIXEdge> */

Example 2

This sample expects a JSON-encoded FIX message, as defined in the Encoding FIX using JSON FIX Trading Community standard.

It includes 3 routes:

  1. json2csv - JSON will be transformed to a CSV file in the '/var/lib/fixedge/work' folder, with a header row as defined below.

  2. dailyMoveFilesToUpload - every day at 12:00AM move files from the '/var/lib/fixedge/work' to the '/var/lib/fixedge/upload'.

  3. uploadToFtpAndMoveToDoneRoute - detect files in the '/var/lib/fixedge/upload' folder, and upload them to the FTP server.

Built-in Processors

To support some typical scenarios in FIXEdge, these custom processors were implemented:

  1. sohToBar - converts 0x01 ('SOH') character to pipe ('|').

  2. barToSOH - converts pipe ('|') character to 0x01 ('SOH').

  3. listToString - converts the body from Java List to String containing JSON-like array.

  4. unwrapFixedgePayload - extracts payload from FIX message XML(213) tag.