Configure your client applications to connect to the Event Gateway to access your subscriptions.
Configuring a client
The Event Gateway manages access to event endpoints in Event Endpoint Management. Configure your client applications to connect to the Event Gateway by using standard Kafka client configuration options.
The way that you provide the configuration settings to your client varies from client to client. However, the following settings are common for every client:
Bootstrap servers
: The set of Event Gateway Server addresses that provide access to an event endpoint can be found in the Catalog page for that event endpoint, in the Server table. If multiple addresses are used, separate them with commas.Security mechanism
: Set asSASL_SSL
if username and password are used in the subscription. Set asSSL
if mTLS is used without a username and password.SSL configuration
: The Event Gateway exposes only a TLS-secured endpoint for clients to connect to. For each Gateway endpoint address, the server certificate can be downloaded (in PEM format) from the Catalog detail page. Configure your client to trust this certificate.SASL
credentials : IfSASL_SSL
is specified as theSASL mechanism
, then setSASL username
, andSASL password
with the values retrieved when you subscribed to the event source.Topic name
: The name of the event endpoint you want your application to use. The name is displayed in the Catalog table under the Topic name column and as the heading of the Catalog detail page when you view more information about an event endpoint.
Testing event endpoints with the Code accelerator
Before using the downloaded configuration for an event endpoint in a complex application, you can test the event endpoint configuration using the code accelerator samples.
Example kcat test of consumer event endpoint
kcat is an open source test tool for Kafka. Follow these steps to test a SASL secured event endpoint with the kcat code accelerator sample:
- Install kcat on a system that has network access to your Event Gateway.
- Log in to the Event Endpoint Management UI by using your login credentials.
- In the navigation pane, click Catalog.
- Select the event endpoint that you want to test.
- If you do not already have a subscription to this event endpoint, then subscribe to get a SASL username and password.
- Expand the Code accelerator section.
- Switch to the kcat tab.
- Copy the kcat sample command and replace the placeholder variables:
<GROUP_ID>
- Replace with a unique string.<CLIENT_ID>
- Replace with a unique string.<CREDENTIALS_USERNAME>
- set to your SASL username.<CREDENTIALS_PASSWORD>
- set to your SASL password.
-
Run the kcat sample command. For example:
kcat -J -G group1 \ -b "grp1-gwy1-ibm-egw-example.apps.ibm.com:443,grp1-gwy1-ibm-egw-example.ibm.com:443,grp1-gwy1-ibm-egw-example.ibm.com:443" \ -X client.id=client1 \ -X security.protocol="SASL_SSL" \ -X ssl.ca.pem="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----" \ -X sasl.mechanisms="PLAIN" \ -X sasl.username="eem-7f0c68e8-3c40-432b-a926-921080c9661d" \ -X sasl.password="f742c545-0ce2-4958-a801-114f242c3d3e" \ "noop"; : # Note: in some versions of kcat the '-t' flag must precede the topic name
The kcat command output displays the events that the event endpoint produces. For example:
% Waiting for group rebalance % Group group1 rebalanced (memberid client1-730ea6d6-6968-4a8b-9900-8652d4f5e310): assigned: noop [0] % Reached end of topic noop [0] at offset 15 {"topic":"noop","partition":0,"offset":15,"tstype":"create","ts":1754311306587,"broker":1,"key":null,"payload":"Sample message value"} % Reached end of topic noop [0] at offset 16 {"topic":"noop","partition":0,"offset":16,"tstype":"create","ts":1754311308412,"broker":1,"key":null,"payload":"Sample message value"} % Reached end of topic noop [0] at offset 17
Tip: If your Kafka cluster is an Event Streams instance, you can create test events with the starter application.