Questo contenuto non è disponibile nella lingua selezionata.
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
-
Download the
rhpam-7.5.1-reference-implementation.zipproduct deliverable file from the Software Downloads page of the Red Hat Customer Portal. -
Extract the contents of the file and then uncompress the
rhpam-7.5.1-openshift-drools-hacep-distribution.zipfile. -
Change to the
openshift-drools-hacep-distribution/sourcesdirectory. -
Review and modify the client code based on the sample project in the
sample-hacep-project/sample-hacep-project-clientdirectory. Ensure that the code fulfills the additional requirements described in Chapter 4, Requirements for HA CEP client code. In the
sample-hacep-project/sample-hacep-project-clientdirectory, generate a keystore, usingpasswordas a password. Enter the following command:keytool -genkeypair -keyalg RSA -keystore src/main/resources/keystore.jksExtract 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 -nopromptIn the
src/main/resourcessubdirectory of the project, create aconfiguration.propertiesfile 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>Replace
<serveraddress>with the address that the route for the Kafka server uses.Build the project using the standard Maven command:
mvn clean installChange the
sample-hacep-project-clientproject directory and enter the following command to run the client:mvn exec:java -Dexec.mainClass="org.kie.hacep.sample.client.ClientProducerDemoThis command executes the
mainmethod of theClientProducerDemoclass.