이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 18. Creating the HA CEP client


You must adapt your CEP client code to communicate with the HA CEP server image. 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 rhpam-7.11.0-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 rhpam-7.11.0-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 19, Requirements for HA CEP client and server code.
  5. To update the KJAR version in an implementation that uses the method described in Chapter 17, Implementing the HA CEP server with a Maven repository for updating the KJAR service, add an UpdateKJarGAV call to the client, similar to the following code:

            TopicsConfig envConfig = TopicsConfig.getDefaultTopicsConfig();
            Properties props = getProperties();
            try (RemoteStreamingKieSession producer = RemoteStreamingKieSession.create(props, envConfig)){
                producer.updateKJarGAV("org.kie:fake-jar:0.1");
            }

    Ensure that a KJAR with the specified GAV is available in the Maven repository when this call is executed.

  6. 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
  7. 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
  8. In the src/main/resources subdirectory of the project, open the configuration.properties file and replace <bootstrap-hostname> with the address that the route for the Kafka server provides.
  9. Build the project using the standard Maven command:

    mvn clean install
  10. 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"

    This command executes the main method of the ClientProducerDemo class.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.