Updated on 2023-04-10 GMT+08:00

Commissioning an Application in Windows

Prerequisites

You have configured Windows to access Kafka in the cluster through an EIP. For details, see Kafka Access Configuration on Windows Using EIPs.

Starting Producer

  1. Ensure that the mappings between the host names and service IP addresses of all the hosts in the remote cluster are configured in the local hosts file.
  2. Run Producer.java on IntelliJ IDEA, as shown in Figure 1.

    Figure 1 Run Producer.java on IntelliJ IDEA

  3. Check the displayed console window and you can find that Producer is sending messages to the default topic (example-metric1). One piece of log is printed when every 10 messages are sent.

    Figure 2 Producer running window

Starting Consumer

  1. Run the Consumer.java file.
  2. Click Run. In the console window that appears, you can find that Producer starts after Consumer successfully starts, and then you can view messages received in real time.

    Figure 3 Consumer.java running window

Starting Other Code Samples

The procedures for starting other code samples are similar to the procedures for starting Producer and Consumer in this section.