Category: IBM Integration Bus

  • Maven and Ant

    I have been working on a project with IIB (IBM Integration Bus). If you are like me, you want to automate all those pesky build tasks. In IIB, I needed to package and build my project (BAR).

    I investigated scripting the build using the mqsipackagebar command . I noticed at the bottom a description of using it with ANT.

    I’ve used ANT in a few projects (in combination with Maven). I took the script as a starting point, added the jar files and property files (based on configuring environments without IIB). I configured the maven-antrun-plugin in order to integrate within my parent project’s maven build.

    Here is some sample code for you, I hope it helps you all get started:

    <project default="buildiib">
    <target name="buildiib">
    <echo message="Beginning the Execution of the IIB Builder" />
    <property environment="env" />
    <echo message="JAVA_HOME is = ${java.home}" />
    <echo message="Base Directory for execution of project is = ${basedir}" />
    <echo message="env.CLASSPATH = ${env.CLASSPATH}" />
    <!-- Executes specific IIB class -->
    <java classname="com.ibm.broker.config.appdev.FlowRendererBAR" failonerror="true" fork="true" newenvironment="true">
    <arg line="-w ./src/main/pipeline/" />
    <arg line="-a testflow.bar" />
    <arg line="-o filePrint.msgflow" />
    <arg line="-y Myapp1" />
    <arg line="-v test.log" />
    <!-- Sets the Classpath -->
    <classpath>
    <pathelement location="." />
    <fileset dir="./src/main/iib/messages">
    <include name="*.jar" />
    </fileset>
    <fileset dir="./src/main/iib/server_classes">
    <include name="*.jar" />
    </fileset>
    <fileset dir="./src/main/iib/classes">
    <include name="*.jar" />
    </fileset>
    <fileset dir="./src/main/iib/jetty">
    <include name="*.jar" />
    </fileset>
    </classpath>
    </java>
    <echo message="Ending the Execution of the IIB Builder" />
    </target>
    </project>
    view raw build.xml hosted with ❤ by GitHub
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mydemo</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>demo.barbuilder</name>
    <url>http://maven.apache.org</url>
    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <build>
    <plugins>
    <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
    <execution>
    <id>build-iib-project</id>
    <phase>package</phase>
    <goals>
    <goal>run</goal>
    </goals>
    <configuration>
    <tasks>
    <ant antfile="build.xml" target="buildiib">
    </ant>
    </tasks>
    </configuration>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
    <!-- Configured Here for those that do not have .m2/settings.xml set to point to maven repository-->
    <repositories>
    <repository>
    <id>maven online</id>
    <name>maven repository</name>
    <url>https://repo1.maven.org/maven2/</url>
    </repository>
    </repositories>
    </project>
    view raw pom.xml hosted with ❤ by GitHub
  • ODBC and ESQL

    To setup ODBC bridge from IBM Integration Bus to Db2, download and install the ODBC bridge from the IBM Data Server Runtime Clients. It’s a 1.3 GB download, and you only need about a 40 MB file for your system.

    The installation is straight forward – Click Next, and Finish.

    The complexity and detailed steps are in the configuration of the ODBC Bridge and IIB.

    To setup the ODBC bridge and IIB, follow these directions:

    1. Start > Run

    2. Type ODBC

    3. Click on Data Sources

    4. Click on `Configure ODBC

    5. Enter the Connection Details

    Name Value
    Username db2admin
    Password fakepass!
    IP 9.32.18.166
    Port 50000
    Database name SAMPLE
    1. Name the alias as SAMPLE

    2. Launch a Command prompt

    3. Start > Run

    4. Enter cmd

    5. Change directory to server\bin

    6. Launch iib

    C:\Program Files\IBM\IIB\10.0.0.4\server\ 
    bin>mqsisetdbparms.exe TESTNODE_cheetah -n SAMPLE -u db2admin -p fakepass!
    
            BIP8071I: Successful command completion. 
            TESTNODE_cheetah should be your local node in Eclipse. 
    

    You want to restart the Node (you can look in the lower right of your toolkit)

    1. Right Click the Node

    2. Select Stop, Then Start

    Now, that it is setup, the steps to read the data, the ESQL is easy:

    CREATE DATABASE MODULE Test2_Database
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    SET Environment.Variables =
    THE (SELECT T.* FROM Database.EMP AS T);
    RETURN TRUE;
    END;
    END MODULE;

    You can then send a message using the IIB tests , and confirm using your database Db2 select * from DB2ADMIN.EMPLOYEE.

    To Write Data, create a New Input Message with

    {
    "EMPNO" : "2229",
    "FIRSTNME" : "Paul",
    "LASTNAME" : "B",
    "JOB" : "PRES",
    "EDLEVEL" : 18
    }
    
    CREATE COMPUTE MODULE CreateData_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    DECLARE Source CHARACTER 'Production' ;
    DECLARE DBSchema CHARACTER 'DB2ADMIN';
    DECLARE Table CHARACTER 'EMPLOYEE';
    SET OutputRoot = InputRoot;
    DECLARE EMPNO1 REFERENCE TO InputRoot.JSON.Data.EMPNO;
    DECLARE FIRSTNME1 REFERENCE TO InputRoot.JSON.Data.FIRSTNME;
    DECLARE LASTNAME1 REFERENCE TO InputRoot.JSON.Data.LASTNAME;
    DECLARE JOB1 REFERENCE TO InputRoot.JSON.Data.JOB;
    DECLARE EDLEVEL1 REFERENCE TO InputRoot.JSON.Data.EDLEVEL;
    INSERT INTO Database.EMPLOYEE (EMPNO, FIRSTNME, LASTNAME, JOB, EDLEVEL)
    VALUES (EMPNO1, FIRSTNME1, LASTNAME1, JOB1, EDLEVEL1);
    -- Set the Repsonse Here
    -- you can modify the initial message, or create a new object
    CREATE FIELD OutputRoot.JSON.Data.SUCCESS TYPE NameValue Value '';
    SET OutputRoot.JSON.Data.SUCCESS = 'Details of Success Are Here';
    PROPAGATE;
    RETURN TRUE;
    END;
    END MODULE;
  • Setting up Db2 JDBC Access

    I have been working IBM Integration Broker 10.0.0.4. I found it hard to find concise documentation on setting up/creating a new provider

    mqsicreateconfigurableservice TESTNODE_cheetah -c JDBCProviders \
    -o DB2Two -n connectionUrlFormat -v \
    "jdbc:db2://[serverName]:[portNumber]/[databaseName]:user=[user];password=[password];"
    
    mqsisetdbparms TESTNODE_cheetah -n jdbc::employeeIdentity -u db2admin -p passw0rd1940!
    
    mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n securityIdentity -v employeeIdentity
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n portNumber -v 50000
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n serverName -v 9.32.18.166
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseType -v DB2
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseName -v SAMPLE
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n jarsURL -v c:\db2jars
    
    mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n type4DatasourceClassName -v com.ibm.db2.jcc.DB2XADataSource
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n type4DriverClassName -v com.ibm.db2.jcc.DB2Driver
    
    mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseVersion -v 10.1
     mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n environmentParms -v ""
    
    mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n jdbcProviderXASupport -v true
    

    Restart the Integration Server

    Links