As mentioned on the following blog post by Lucas Jellema, Kafka is going to play a part in several Oracle products. For some usecases it might eventually even replace JMS. In order to allow for easy integration with Kafka, you can use Oracle Service Bus to create a virtualization layer around Kafka. Ricardo Ferreira from Oracle’s A-Team has done some great work on making a custom Kafka Service Bus transport available to us. Read more about this here, here and here. The Kafka transport is not an ‘officially supported’ transport. Quote from the A-team blog: ‘The Kafka transport is provided for free to use “AS-IS” but without any official support from Oracle. The A-Team reserves the right of help in the best-effort capacity.’. I hope it will become an officially supported part of the Service Bus product in the future.
In this blog I summarize what I have done to get the end to end sample working for SOA Suite 12.2.1.2.0 and Kafka 0.10.1.0 based on the blogs I mentioned. This allows you to quickly start developing against Apache Kafka.
Setting up Apache Kafka
- Setting up Apache Kafka for development is easy. You follow the quickstart on: https://kafka.apache.org/quickstart. To summarize the quickstart:
- Download Apache Kafka: https://www.apache.org/dyn/closer.cgi?path=/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz
- Unzip it: tar -xzf kafka_2.11-0.10.1.0.tgz
- Go to the Kafka directory: cd kafka_2.11-0.10.1.0
- Start ZooKeeper: bin/zookeeper-server-start.sh config/zookeeper.properties
- Start a new console
- Start the Kafka broker: bin/kafka-server-start.sh config/server.properties
- Create a topic: bin/kafka-topics.sh –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic test
Setting up the Kafka transport in OSB
Copy the following files:
- $KAFKA_HOME/libs/slf4j-api-1.7.21.jar
- $KAFKA_HOME/libs/kafka-clients-0.10.1.0.jar
To $OSB_DOMAIN/lib.
In my case this was /home/oracle/.jdeveloper/system12.2.1.2.42.161008.1648/DefaultDomain/lib. I’m using the JDeveloper IntegratedWebLogicServer
Download the Kafka transport from here: http://www.ateam-oracle.com/wp-content/uploads/2016/10/kafka-transport-0.4.1.zip
Extract the zip file.
Copy kafka-transport.ear and kafka-transport.jar to $MW_HOME/osb/lib/transports.
Start the domain
Execute install.py from the kafka-transport zipfile. Use wlst.sh in my case from: /home/oracle/Oracle/Middleware12212/Oracle_Home/oracle_common/common/bin/wlst.sh
Provide the required information. It will ask for Url, username, password of your WebLogic server and deploy the kafka-transport.jar and kafka-transport.ear to the specified server (AdminServer + cluster targets). If the deployments are already there, they are first undeployed by the script.
Stop the domain
The below part I got from the following blog. This is required to be able to configure the Kafka transport from the webinterface.
Locate the following file: $MW_HOME/osb/lib/osbconsoleEar/webapp/WEB-INF/lib/adflib_osb_folder.jar.
Extract this JAR and edit /oracle/soa/osb/console/folder/l10n/FolderBundle.properties.
Add the following entries:
desc.res.gallery.kafka=The Kafka transport allows you to create proxy and business services that communicate with Apache Kafka brokers.
desc.res.gallery.kafka.proxy=The Kafka transport allows you to create proxy services that receive messages from Apache Kafka brokers.
desc.res.gallery.kafka.business=The Kafka transport allows you to create business services that route messages to Apache Kafka brokers.
ZIP up the result as a new adflib_osb_folder.jar
Check the Service Bus console
After the above steps are completed, you can start the domain and use the Kafka transport from the servicebus console.
