Connect to your cluster and send transaction messages
This section describes how to connect to your cluster and send transaction messages.Before you begin
- Before using an API key, verify that the service account is authorized to access the resources, such as tenants, namespaces, and topics.
- The password for different utilities as
kcatwill be equal totoken:<API KEY>.
Steps
-
Add Maven dependencies.
-
Open a terminal and run a Kafka consumer to receive a message from the
test-transaction-topictopic. In this case, the isolation level toread_committed, which means only 5 committed messages will be consumed, if you want to consume both committed and uncommitted messages, set it toread_uncommitted.serverUrl: the Kafka service URL of your StreamNative cluster.jwtToken: an API key of your service account.
-
Open another terminal and run a Kafka producer to send 5 messages to the
test-transaction-topictopic and commit it, then send 5 messages and abort it.serverUrl: the Kafka service URL of your StreamNative cluster.jwtToken: an API key of your service account.