Connect to Aiven for Apache Kafka® with Java using Quick connect
Use quick connect to set up a Java client for Aiven for Apache Kafka®. The step-by-step process helps you create a topic, configure authentication, define a schema, and download ready-to-use client code.
Prerequisites
- A running Aiven for Apache Kafka® service
- Java development environment with Maven
Step 1: Open quick connect and select Java
-
In the Aiven Console, select your Aiven for Apache Kafka service.
-
To open Quick connect, do one of the following:
- In the Set up your stream section, click Quick connect.
- In the Connection information section, click Quick connect.
-
On the Select programming language screen, select Java, then click Next.
Step 2: Create a topic
Topics organize and store the events you stream to Apache Kafka.
- Select an existing topic or click Create new topic. If you create a topic, it is auto-selected for the next steps.
- Click Next.
Step 3: Select an authentication method
-
Choose one of the following:
- Client certificate (mTLS): Recommended for secure environments.
- SASL/SCRAM: Use for flexible access control with user credentials.
-
Click Next.
Step 4: Set up schema and access
The next steps depend on the authentication method you selected.
-
If you selected Client certificate (mTLS):
- Select a schema format: Avro, JSON Schema, or Protobuf.
- Upload a schema or modify the sample schema.
- If using Protobuf, you can also add schema references:
- Select an existing schema.
- In the Add a schema reference screen, enter a reference name and select a version.
- In the schema editor, modify the schema if needed.
- Click Add reference.
- Click Create schema.
-
If you selected SASL/SCRAM:
-
Select an existing service user, or click Create new service user.
-
Click Grant access.
note- If you use the
avnadmin
user, permissions are granted by default and cannot be changed. - For new service users, you can grant additional permissions later (for example, add consume access if only produce was given).
- Once a permission is granted, it cannot be removed. To remove access, delete the user’s ACL permissions.
- If you use the
-
Select a schema format: Avro, JSON Schema, or Protobuf.
-
Upload a schema or modify the sample schema.
-
If using Protobuf, you can also add schema references:
- Select an existing schema.
- In the Add a schema reference screen, enter a reference name and select a version.
- In the schema editor, modify the schema if needed.
- Click Add reference.
-
Click Create schema.
-
Step 5: Connect your client
-
Download the required certificates:
-
For mTLS, download the CA certificate and the service certificate and access key.
-
For SASL/SCRAM, download the CA certificate.
noteFor SASL/SCRAM, your client must trust Aiven’s certificate authority (CA). The sample producer code includes a
keytool
command to create a truststore:keytool -import -file ca.pem -alias AivenCA -keystore client.truststore.jks
You only need to run the command if you are setting up the client manually.
-
-
Review the generated Java producer and consumer code snippets.
-
Copy the code snippets or download the client template files.
-
Click Done to complete the setup.
Related pages