To learn more about how you can create applications that can take advantage of IBM Event Streams capabilities, generate a starter application. The starter application can produce and consume messages, and you can specify the topic where you want to send messages to.
About the application
The starter application provides a demonstration of a Java application running on WebSphere Liberty that sends events, receives events, or both, by using IBM Event Streams.
The Java classes in the
application.kafka package are designed to be independent of the specific use case for Kafka. The
application.kafka sample code is used by the
application.demo package and can also be used to understand the elements required to create your own Kafka application.
src/main/java/application/demo folder contains the framework for running the sample in a user interface, providing an easy way to view message propagation.
The starter application is generated with the correct security configurations to connect to IBM Event Streams. These security configurations include a
.jks file for the certificate and API keys for producing and consuming messages. For more information, see the instructions for connecting clients.
Note: The API keys generated for the starter application can only be used to connect to the topic selected during generation. In addition, the consumer API key can only be used to connect with a consumer group ID set to the name of the generated application.
Generating and running
To generate the application:
- Ensure you have Java version 8. Also, ensure you have Apache Maven installed on your system.
- Log in to your IBM Event Streams UI.
- Click the Generate a starter application tile, or click the Toolbox tab, and go to the Starter application section and click Generate application.
- Provide a name for the application.
- Decide whether you want the application to produce or consume messages, or both.
- Specify a target topic for the messages from the application.
- Click Generate. The application is created.
- Download the compressed file and extract the file to a preferred location.
- Navigate to the extracted file, and run the following command to build and deploy the application:
mvn install liberty:run-server
- Access the successfully deployed sample application using the following URL:
- Click Close and go to topics to see your topic and check the messages generated by the application.
Note: Some of these options depend on your access permissions. If you are not permitted to create topics, you will not be able to create a topic as part of building the starter application. If you are not permitted to write to topics, you will not be able to create a starter application that produces messages, only consumes them.