此内容没有您所选择的语言版本。

Chapter 3. Creating the HA CEP client


You must adapt your CEP client code to communicate with the HA CEP server image. You can use the sample project included in the reference implementation for your client code. You can run your client code inside or outside the OpenShift environment.

Procedure

  1. Download the rhdm-7.5.1-reference-implementation.zip product deliverable file from the Software Downloads page of the Red Hat Customer Portal.
  2. Extract the contents of the file and then uncompress the rhdm-7.5.1-openshift-drools-hacep-distribution.zip file.
  3. Change to the openshift-drools-hacep-distribution/sources directory.
  4. Review and modify the client code based on the sample project in the sample-hacep-project/sample-hacep-project-client directory. Ensure that the code fulfills the additional requirements described in Chapter 4, Requirements for HA CEP client code.
  5. In the sample-hacep-project/sample-hacep-project-client directory, generate a keystore, using password as a password. Enter the following command:

    keytool -genkeypair -keyalg RSA -keystore src/main/resources/keystore.jks
    Copy to Clipboard Toggle word wrap
  6. Extract the HTTPS certificate from the OpenShift environment and add it to the keystore. Enter the following commands:

    oc extract secret/my-cluster-cluster-ca-cert --keys=ca.crt --to=- > src/main/resources/ca.crt
    keytool -import -trustcacerts -alias root -file src/main/resources/ca.crt -keystore src/main/resources/keystore.jks -storepass password -noprompt
    Copy to Clipboard Toggle word wrap
  7. In the src/main/resources subdirectory of the project, create a configuration.properties file with the following content:

    ssl.keystore.location=keystore.jks
    ssl.truststore.location=keystore.jks
    ssl.keystore.password=password
    ssl.truststore.password=password
    bootstrap.servers=http://<serveraddress>
    Copy to Clipboard Toggle word wrap

    Replace <serveraddress> with the address that the route for the Kafka server uses.

  8. Build the project using the standard Maven command:

    mvn clean install
    Copy to Clipboard Toggle word wrap
  9. Change the sample-hacep-project-client project directory and enter the following command to run the client:

    mvn exec:java -Dexec.mainClass="org.kie.hacep.sample.client.ClientProducerDemo
    Copy to Clipboard Toggle word wrap

    This command executes the main method of the ClientProducerDemo class.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部