Getting started with Event Streams for IBM Cloud
IBM® Event Streams for IBM Cloud® is a high-throughput message bus that is built with Apache Kafka. To get started with this managed Kafka on IBM Cloud® service and start sending and receiving messages, you can use the Java™ sample. The sample shows how a producer sends messages to a consumer by using a topic. The same sample program is used to consume messages and produce messages.
To understand more about how Event Streams works, see Event Streams overview. Event Streams was previously called Message Hub.
To access Event Streams samples, see our primary sample repository at Event Streams samples. Other Event Streams samples, including samples for Node.js and Python, are available at the previous Event Streams repository.
Prerequisites
-
If you don't already have one, create an Event Streams service instance.
a. Log in to the IBM Cloud console.
b. Click the Event Streams service in the Catalog.
c. Select the Lite plan on the service instance page.
d. Enter a name for your service. You can use the default value.
e. Click Create. The Event Streams Getting started page opens.
-
If you don't already have them, install the following prerequisites:
- Git
- Java™ 8 or higher
Tutorial steps
-
In the IBM Cloud console (UI), go to your Resource list, select your Event Streams resource, and click the Get started with a sample application tile.
-
Complete the Configure and run starter application steps:
a. Click the Download .JAR from GitHub button to download the latest .JAR release.
b. Click the Generate properties button to generate and download the properties file. The Topic panel opens.
c. Enter a name for a New topic that you want to create. Or, click Existing topic to select an existing topic that you want to use.
If you are on the Lite plan and a topic already exists, the New topic button is disabled.
d. Select the Service credential that you want to use, or select Create new to create a new one.
e. Click the Generate and download button. The
kafka.properties
file is downloaded to your local machine. It contains the necessary configuration to connect to Event Streams. You can open it in a text editor to see how it works.f. The panel shows your selected configuration. Clicking the Regenerate button starts the process again. Clicking the Download button downloads the properties file again.
-
Navigate to the folder that contains the downloaded .JAR file by using the command line or a terminal and run the command. Replace the value
<path-to-properties>
with the file path to thekafka.properties
file. -
When the application starts, click the localhost:8080 link to open the starter app and see messages flowing through the topic.
Next steps
Now that you ran the starter application, you can try other Event Streams samples. Explore other ways to connect to the Event Streams service or find out more about Event Streams on IBM Cloud Satellite, a hybrid environment that combines public cloud services running in your secure private cloud.
To watch a video that walks you through getting a Java sample to run, see Getting started with IBM Event Streams.