Skip to content

Commit 1029f65

Browse files
authored
Merge pull request #216901 from spelluru/ehubkafka1102
Make connection string default
2 parents 62f9a56 + b023381 commit 1029f65

File tree

2 files changed

+51
-50
lines changed

2 files changed

+51
-50
lines changed

articles/event-hubs/event-hubs-capture-enable-through-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Event Hubs - Capture streaming events using Azure portal
33
description: This article describes how to enable capturing of events streaming through Azure Event Hubs by using the Azure portal.
44
ms.topic: quickstart
5-
ms.date: 10/27/2021
5+
ms.date: 10/27/2022
66
ms.custom: mode-ui
77
---
88

articles/event-hubs/event-hubs-quickstart-kafka-enabled-event-hubs.md

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Quickstart: Data streaming with Azure Event Hubs using the Kafka protocol'
33
description: 'Quickstart: This article provides information on how to stream into Azure Event Hubs using the Kafka protocol and APIs.'
44
ms.topic: quickstart
5-
ms.date: 09/26/2022
5+
ms.date: 11/02/2022
66
ms.custom: mode-other
77
---
88

@@ -33,6 +33,55 @@ When you create an Event Hubs namespace, the Kafka endpoint for the namespace is
3333
3434
## Send and receive messages with Kafka in Event Hubs
3535

36+
37+
### [Connection string](#tab/connection-string)
38+
39+
1. Clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
40+
41+
1. Navigate to *azure-event-hubs-for-kafka/quickstart/java/producer*.
42+
43+
1. Update the configuration details for the producer in *src/main/resources/producer.config* as follows:
44+
45+
```xml
46+
bootstrap.servers=NAMESPACENAME.servicebus.windows.net:9093
47+
security.protocol=SASL_SSL
48+
sasl.mechanism=PLAIN
49+
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";
50+
```
51+
52+
> [!IMPORTANT]
53+
> Replace `{YOUR.EVENTHUBS.CONNECTION.STRING}` with the connection string for your Event Hubs namespace. For instructions on getting the connection string, see [Get an Event Hubs connection string](event-hubs-get-connection-string.md). Here's an example configuration: `sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXX";`
54+
55+
1. Run the producer code and stream events into Event Hubs:
56+
57+
```shell
58+
mvn clean package
59+
mvn exec:java -Dexec.mainClass="TestProducer"
60+
```
61+
62+
1. Navigate to *azure-event-hubs-for-kafka/quickstart/java/consumer*.
63+
64+
1. Update the configuration details for the consumer in *src/main/resources/consumer.config* as follows:
65+
66+
```xml
67+
bootstrap.servers=NAMESPACENAME.servicebus.windows.net:9093
68+
security.protocol=SASL_SSL
69+
sasl.mechanism=PLAIN
70+
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";
71+
```
72+
73+
> [!IMPORTANT]
74+
> Replace `{YOUR.EVENTHUBS.CONNECTION.STRING}` with the connection string for your Event Hubs namespace. For instructions on getting the connection string, see [Get an Event Hubs connection string](event-hubs-get-connection-string.md). Here's an example configuration: `sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXX";`
75+
76+
1. Run the consumer code and process events from event hub using your Kafka clients:
77+
78+
```java
79+
mvn clean package
80+
mvn exec:java -Dexec.mainClass="TestConsumer"
81+
```
82+
83+
If your Event Hubs Kafka cluster has events, you'll now start receiving them from the consumer.
84+
3685
### [Passwordless (Recommended)](#tab/passwordless)
3786
1. Enable a system-assigned managed identity for the virtual machine. For more information about configuring managed identity on a VM, see [Configure managed identities for Azure resources on a VM using the Azure portal](../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md#system-assigned-managed-identity). Managed identities for Azure resources provide Azure services with an automatically managed identity in Azure Active Directory. You can use this identity to authenticate to any service that supports Azure AD authentication, without having credentials in your code.
3887

@@ -92,54 +141,6 @@ Azure Event Hubs supports using Azure Active Directory (Azure AD) to authorize r
92141

93142
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/producer-consumer-output.png" alt-text="Screenshot showing the Producer and Consumer app windows showing the events.":::
94143

95-
### [Connection string](#tab/connection-string)
96-
97-
1. Clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
98-
99-
1. Navigate to *azure-event-hubs-for-kafka/quickstart/java/producer*.
100-
101-
1. Update the configuration details for the producer in *src/main/resources/producer.config* as follows:
102-
103-
```xml
104-
bootstrap.servers=NAMESPACENAME.servicebus.windows.net:9093
105-
security.protocol=SASL_SSL
106-
sasl.mechanism=PLAIN
107-
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";
108-
```
109-
110-
> [!IMPORTANT]
111-
> Replace `{YOUR.EVENTHUBS.CONNECTION.STRING}` with the connection string for your Event Hubs namespace. For instructions on getting the connection string, see [Get an Event Hubs connection string](event-hubs-get-connection-string.md). Here's an example configuration: `sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXX";`
112-
113-
1. Run the producer code and stream events into Event Hubs:
114-
115-
```shell
116-
mvn clean package
117-
mvn exec:java -Dexec.mainClass="TestProducer"
118-
```
119-
120-
1. Navigate to *azure-event-hubs-for-kafka/quickstart/java/consumer*.
121-
122-
1. Update the configuration details for the consumer in *src/main/resources/consumer.config* as follows:
123-
124-
```xml
125-
bootstrap.servers=NAMESPACENAME.servicebus.windows.net:9093
126-
security.protocol=SASL_SSL
127-
sasl.mechanism=PLAIN
128-
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";
129-
```
130-
131-
> [!IMPORTANT]
132-
> Replace `{YOUR.EVENTHUBS.CONNECTION.STRING}` with the connection string for your Event Hubs namespace. For instructions on getting the connection string, see [Get an Event Hubs connection string](event-hubs-get-connection-string.md). Here's an example configuration: `sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXX";`
133-
134-
1. Run the consumer code and process events from event hub using your Kafka clients:
135-
136-
```java
137-
mvn clean package
138-
mvn exec:java -Dexec.mainClass="TestConsumer"
139-
```
140-
141-
If your Event Hubs Kafka cluster has events, you will now start receiving them from the consumer.
142-
143144
---
144145

145146
## Next steps

0 commit comments

Comments
 (0)