Using the Event Streams CLI

The IBM Event Streams service provides a managed instance of Apache Kafka on IBM Cloud. IBM Event Streams comes with an Event Streams plugin for the IBM Developer Tools CLI.

Install the Event Streams plugin

$ ibmcloud plugin install event-streams

$ ibmcloud plugin install event-streams
Looking up 'event-streams' from repository 'IBM Cloud'...
Plug-in 'event-streams 2.0.0' found in repository 'IBM Cloud'
Attempting to download the binary file...
30.95 MiB / 30.95 MiB [===========================================] 100.00% 17s
32455568 bytes downloaded
Installing binary...
OK
Plug-in 'event-streams 2.0.0' was successfully installed into /Users/user1/.bluemix/plugins/event-streams.
Use 'ibmcloud plugin show event-streams' to show its details.

Initialize the Event Streams plugin

$ ibmcloud es init

$ ibmcloud es init
API Endpoint: https://abcde1fghijk23lm.svc01.us-south.eventstreams.cloud.ibm.com
OK

Login to IBM Cloud

$ ibmcloud login -a cloud.ibm.com
$ ibmcloud target --cf
$ ibmcloud target -g default

Create an Event Streams Instance

$ ibmcloud resource service-instance-create <instance-name> messagehub enterprise|standard <region>

$ ibmcloud resource service-instance-create remkohdev-eventstreams messagehub standard us-south
Creating service instance remkohdev-eventstreams in resource group default of account REMKOHDEV's Account as [email protected]
OK
Service instance remkohdev-eventstreams was created.
Name: remkohdev-eventstreams
ID: crn:v1:bluemix:public:messagehub:us-south:a/1ab2c3de456789fg01h23i4j5k6l78mn:12a34bc5-de67-8f9g-h012-34i567jk8901::
GUID: 12a34bc5-de67-8f9g-h012-34i567jk8901
Location: us-south
State: active
Type: service_instance
Sub Type:
Created at: 2019-10-17T15:04:16Z
Updated at: 2019-10-17T15:04:16Z

Create an API Key for the Event Streams Instance

$ ibmcloud resource service-key-create <key-name> <role-name> --instance-name <instance-name>

Role names include: Manager, Writer, and Reader.

$ ibmcloud resource service-key-create $USERNAME-kafka-eventstreams-credentials1 Manager --instance-name $USERNAME-kafka-eventstreams

Create a Topic

$ ibmcloud es topic-create greetings -p 1

$ ibmcloud es topic-create greetings
Created topic greetings
OK

Display Topic Details

$ ibmcloud es topic greetings

$ ibmcloud es topic greetings
Details for topic greetings
Topic name Internal? Partition count Replication factor
greetings false 1 3
Partition details for topic greetings
Partition ID Leader Replicas In-sync
0 0 [0 4 5] [0 4 5]
Configuration parameters for topic greetings
Name Value
cleanup.policy delete
min.insync.replicas 2
segment.bytes 536870912
retention.ms 86400000
retention.bytes 1073741824