ODM on Docker!
If you are a DevOps enthusiast like me you probably love Docker and have been using it for a while. If you are new to Docker, please check this link to learn more.
IBM released an IBM ODM Docker image designed for developers and free to use, in this tutorial we are going to set it up step by step and gain full functionality of this amazing feature. My setup for running this tutorial is:
- Host machine: Windows 10 Pro
- Elementary OS (Ubuntu Dist.) Virtual Box Machine with Docker (I tried using my Alpine-Docker image but I encountered some extra configurations needed for the ODM JVM, contact me for more information about this subject)
- Eclipse Luna with Rule Designer for developers plugin
Steps:
- Install IBM ODM Docker image
- Open a new terminal window and run the following command: docker pull ibmcom/odm
- This will download all the ODM files and create the IBM ODM image. Depending on your internet conection this process could take a few minutes.
- Now run the following command to start the docker IBM ODM container instance:
docker run -e LICENSE=accept -p 9060:9060 -p 9443:9443 ibmcom/odm
- Note that we are passing an environment value to accept the license and mapping the ports 9060 and 9443. If you run with JVM memory problems use -m 1g or the amount of java heap size memory you can use for this container to run smoothly and faster.
- If everything went well you should see the beautiful IBM ODM logo printed in the terminal
- Now you are ready to use:
- Note that if you are using a Virtual Box VM like me you need to configure your networks and ip addresses to use the web applications in your host. In my case I use the 192.168.56.101 ip. See Host-Only adapter configurations and verify your networks by pinging the VM ip.
- Verify Installation
- Install Eclipse with IBM ODM plugin
- Download and install Eclipse.
- Navigate to https://marketplace.eclipse.org/content/ibm-operational-decision-manager-developers-rule-designer and drag and drop the install
- Follow the instructions and reboot Eclipse, you should now see the Rule Designer perspective:
- Test IBM ODM on Docker
- Create a new project or import an existing project, I am going to use the Recruitment Service demo that I’ve using on previous posts:
- Connect the main project to the Decision Center
- Enter the proper URL and credentials and test the conection:
- Navigate to the Decision Center and verify the Decision Service is uploaded correctly:
- Now we will test the deployment to the RES console, create a new Deployment Configuration
- Add a Decision Operation
- Add the ODM docker RES service
- Deploy the Ruleapp and select the recently added server
- Verify the ruleapp deployed correctly
As you can see we setup an ODM distribution in minutes and got a project sync with Decision Center and deployed in the RES console. ODM on Docker is great, we can use all the Docker containers and images functionalities.
I hope you enjoy this tutorial and as always please feel free to contact me for any feedback or questions! Thank you!
- Published in Cloud, Decision Center, Docker, Rule Designer, Rule Execution Server (RES)
Connecting to external Database with ODM API
The IBM ODM Decision Center and the Rule Execution Server values are stored, by default, in a Derby database that comes with the IBM ODM suite installation. During a rules development project we sometimes need to access these values and insert them on an external database or update this external database accordingly. In this post I will show you how to connect to an external Datase with the ODM API in java and execute a simple query after collecting Decision Center values. You can use this method in your project with any values you need from the Decision Center.
To understand the basics of the ODM API, please refer to my previous post about the IBM ODM API here.
- Preparing Decision Center Values
- Connecting to an External DB
- Let’s create a new Java class with the Connection details.
- It is a good practice to have the value of the connection datasource in a properties file.
- Create a getConnection() method in the DBConnection class and add the following structure:
- Return the con variable and call this method from the main ODM API java class:
Now you are ready to execute any statement in the external DB using the Decision Center variables. Query statement sample: ps = con.prepareStatement(“INSERT INTO db.dt VALUES (‘”+ruleProject.getName())
I hope you enjoy this tutorial and please feel free to contact me with any query or feedback, thank you!
- Published in Debug, Decision Center, Decision Table, Java, ODM API, Rule Designer
Working with the Decision Center API
In many IBM ODM rules implementation projects we are going to have requirements that involve working with the IBM ODM API. Even though the Decision Center has a lot of powerful features to customize our rules, there are some things that can only be achieve by working with the API, this means we will have to work with java code and be familiar with the ODM API classes to accomplish our goals. In this tutorial I will show you the basics of how to establish a connection with the Decision Center from the Rule Designer and retrieve valuable project information. You can apply this for your particular requirement.
Steps:
- Getting familiar with ODM API
- We first need to take a moment and review some of the most important classes in the IBM ODM API documentation (IlrSession) , it’s ok if you don’t fully understand how they work at first. It is all about practice.
- Enter here to access the documentation.
- Creating a Java project
- Establishing the decision center connection
- Create a new main class to test our remote ODM API decision center connection
- Our java class needs to implement the IlrSession class:
- Create your connection parameters, in my case:
- Now in our main class we need to create an object of the IlrSessionFactory class that implements IlrRemoteSessionFactory
- Lets call the connect method:
- Tip: be sure to work in a try/catch block to manage any connection exceptions
- Obtaining Decision Center data
Results:
We can work and obtain pretty much any data, object or method that is inside the Decision Center repository. We can also create our custom jar classes and repackage the teamserver.ear with it.
I hope you enjoy this tutorial and please let me now if you need help working with the ODM API and what do you want to see next. Thank you!
- Published in Decision Center, ODM API, Rule Designer
- 1
- 2