Enabling the event emitter
You can enable the emission of events to Business Automation Insights manually, by using Ant tasks, or in a Java SE application.
Before you begin
Property | Definition | Default value |
---|---|---|
topic |
The name of the topic that is used to send events to the Kafka provider. |
- |
kafka.bootstrap.servers |
The list of bootstrap servers for Kafka for |
- |
kafka.security.protocol |
If security is enabled, SASL_SSL indicate the protocol that is used to communicate. |
- |
kafka.ssl.protocol |
SSL protocol that is used by the server TLSv1.2. |
- |
kafka.ssl.truststore.location |
The Path to a truststore.jks file that contains the certificate for the Kafka server. |
- |
kafka.ssl.truststore.password |
The password for the truststore.jks file. |
- |
kafka.sasl.mechanism |
The SASL connection |
- |
kafka.sasl.jaas.config |
Configuration parameters that are based the SASL mechanism:
|
- |
kafka.retries | - |
10 |
kafka.acks | - |
All |
kafka.key.serializer | - |
|
kafka.value.serializer | - |
|
Creating the configuration file
When you have the Kafka server properties, create a
plugin-configuration.properties file that contains the relevant properties. The
properties are prefixed with com.ibm.rules.bai.plugin
.
The following sample includes comments (#
) on usage:
#This is comma-separated list for the Kafka broker server and IP.
com.ibm.rules.bai.plugin.topic=<myTopic>
com.ibm.rules.bai.plugin.kafka.bootstrap.servers= <io:port>
com.ibm.rules.bai.plugin.kafka.security.protocol=SASL_SSL
com.ibm.rules.bai.plugin.kafka.ssl.truststore.location=<certs.jks_file_location>
com.ibm.rules.bai.plugin.kafka.ssl.truststore.password=<password>
com.ibm.rules.bai.plugin.kafka.ssl.protocol=TLSv1.2
#If you are using PLAIN authentication, uncomment and fill in the following 2 lines. Uncomment a line by removing #.
#com.ibm.rules.bai.plugin.kafka.sasl.mechanism=PLAIN
#com.ibm.rules.bai.plugin.kafka.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="<userName>" password="<password>";
#Comment the following 2 lines if you are not using SCRAM authentication. Comment a line by adding #.
com.ibm.rules.bai.plugin.kafka.sasl.mechanism=SCRAM-SHA-512
com.ibm.rules.bai.plugin.kafka.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="<userName>" password="<password>";
Enabling the emitter manually
You can enable an execution unit (XU) so that it can send events to Business Automation Insights by adding a plug-in in the deployment descriptor file.
- Open the ra_xml file for your application server:
- Liberty
<odm_install_dir>/executionserver/applicationservers/WLP/DecisionService.war
- New in
8.10.2
Tomcat
<odm_install_dir>/executionserver/applicationservers/tomcat/DecisionService.war
- New in
8.10.2 Websphere Application
Server
<odm_install_dir>/executionserver/applicationservers/websphere/jrules-res-xu-WAS.rar
- New in
8.10.2
JBoss
<odm_install_dir>/executionserver/applicationservers/jboss/jrules-res-xu-JBOSS.rar
- Liberty
- Under the
plugins
section in the ra_xml file, add the ODM event emitter plug-in class and attributes in theconfig-property-value
element:<config-property> <config-property-name>Plugins</config-property-name> <config-property-type>java.lang.String</config-property-type> <config-property-value> {...}, {pluginClass=ODMEmitterForBAI} </config-property-value></config-property>
- Repackage the application. Place the modified ra.xml file with the
plugin-configuration.properties
inWEB-INF/classes
into its .rar or .war archive. - Redeploy the application in the server, and restart the server.
Enabling the emitter by using an Ant task
You can enable the ODM event emitter by using the res-setup
Ant task.
The res-setup
parameters that are used to configure the ODM event emitter are
described in res-setup. They are prefixed with bai. In
addition to the mandatory attributes, select the relevant optional attributes for your installation,
in particular the authentication parameters for the Kafka producer.
- Create a plugin-configuration.properties file as shown in the section Creating the configuration file .
- Run the
res-setup
Ant task for your application server.- Liberty
cd <odm_install_dir>/executionserver/bin <odm_install_dir>/shared/tools/ant/bin/ant -f ressetup.xml -Dbai.war.in=../applicationservers/WLP/DecisionService.war -Dbai.war.out=<my_output_dir>/DecisionService.war -Dbai.enable=true -Dbai.properties=plugin-configuration.properties setup-bai
- New in
8.10.2 Tomcat
cd <odm_install_dir>/executionserver/bin <odm_install_dir>/shared/tools/ant/bin/ant -f ressetup.xml -Dbai.war.in=../applicationservers/tomcat/DecisionService.war -Dbai.war.out=<my_output_dir>/DecisionService.war -Dbai.enable=true -Dbai.properties=plugin-configuration.properties setup-bai
- New in
8.10.2 Websphere Application Server
cd <odm_install_dir>/executionserver/bin <odm_install_dir>/shared/tools/ant/bin/ant -f ressetup.xml -Dxu.in=../applicationservers/websphere/jrules-res-xu-WAS.rar -Dxu.out=<my_output_dir>/jrules-res-xu-WAS.rar -Dbai.enable=true -Dbai.properties=plugin-configuration.properties setup-bai
- New in
8.10.2
JBoss
cd <odm_install_dir>/executionserver/bin <odm_install_dir>/shared/tools/ant/bin/ant -f ressetup.xml -Dxu.in=../applicationservers/jboss/jrules-res-xu-JBOSS.rar -Dxu.out=<my_output_dir>/jrules-res-xu-JBOSS.rar -Dbai.enable=true -Dbai.properties=plugin-configuration.properties setup-bai
Theproperties_file
variable is the path to the configuration property file that you created in step 1. The path can be absolute or relative. The relative path is in respect to the directory in which the command is run. For example, both of the following paths are valid:/Users/me/config/plugin-configuration.properties
../../config/plugin-configuration.properties
The Ant task extracts the plug-in parameters from the file and copies them into the
ra.xml
file. - Liberty
- Deploy the generated output file to your application server:
- Liberty: Refer to Deploying the hosted transparent decision service.
- Tomcat: Refer to Deploying the hosted transparent decision service.
- Websphere Application Server: Refer to Deploying the XU RAR.
- JBoss: Refer to Deploying the XU RAR
- Restart the application server.
Enabling the emitter in Java SE application
You can enable your Java SE rule application to emit events to Business Automation Insights.
- In your Java application, open your
IlrSessionFactoryConfig
instance (see XU configuration properties for Java SE), for example:IlrSessionFactoryConfig config = IlrJ2SESessionFactory.createDefaultConfig(); ... sessionFactory factory = new IlrJ2SESessionFactory(config);
- Before the line that creates the session factory, insert the following code to enable the ODM
emitter
plug-in:
// TODO Configure BAI properties in the file plugin-configuration.properties IlrPluginConfig baiIlrPluginConfig = config.getXUConfig().createPluginConfig("ODMEmitterForBAI"); List<IlrPluginConfig> plugins = config.getXUConfig().getPluginConfigs(); plugins.add(baiIlrPluginConfig); config.getXUConfig().setPluginConfigs(plugins);
- Your Java application class path must contain the following JARs from
ILOG_RULEXECUTION_SERVER/lib:
- bai-events-java-sdk
- bai-odm-events-java-sdk
- jackson-annotations
- jackson-core
- jackson-databind
- javax.json
- joda-time
- kafka-clients
- Create a plugin-configuration.properties file as shown in the section Creating the configuration file .
- Place the plugin-configuration.properties file in the class path of the
application. Your application is now ready to emit events to Business Automation Insights. Tip: Remember to enable the ruleset properties for each ruleset.