Skip to content

Commit c5d80b5

Browse files
committed
More tweaks
1 parent a5ee35b commit c5d80b5

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

articles/service-bus-messaging/service-bus-migrate-azure-credentials.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ await using var client = new ServiceBusClient("<CONNECTION-STRING>");
3434

3535
## [Java](#tab/java)
3636

37+
**Receiver client:**
38+
39+
```java
40+
ServiceBusReceiverClient receiver = new ServiceBusClientBuilder()
41+
.connectionString("<CONNECTION-STRING>")
42+
.receiver()
43+
.topicName("<TOPIC-NAME>")
44+
.subscriptionName("<SUBSCRIPTION-NAME>")
45+
.buildClient();
46+
```
47+
48+
**Sender client:**
49+
3750
```java
3851
ServiceBusSenderClient client = new ServiceBusClientBuilder()
3952
.connectionString("<CONNECTION-STRING>")
@@ -102,7 +115,7 @@ Next, update your code to use passwordless connections.
102115
using Azure.Identity;
103116
```
104117

105-
1. Identify the locations in your code that create a `ServiceBusClient` to connect to Azure Service Bus. Update your code to match the following example:
118+
1. Identify the locations in your code that create a `ServiceBusClient` object to connect to Azure Service Bus. Update your code to match the following example:
106119

107120
```csharp
108121
//TODO: Replace the <SERVICE-BUS-NAMESPACE-NAME> placeholder.
@@ -123,7 +136,23 @@ Next, update your code to use passwordless connections.
123136
import com.azure.identity.DefaultAzureCredentialBuilder;
124137
```
125138

126-
1. Identify the locations in your code that create a `ServiceBusSenderClient` or `ServiceBusSenderAsyncClient` object to connect to Azure Service Bus. Update your code to match the following example:
139+
1. Identify the locations in your code that create a Service Bus sender or receiver client object to connect to Azure Service Bus. Update your code to match one of the following examples:
140+
141+
**Receiver client:**
142+
143+
```java
144+
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder()
145+
.build();
146+
147+
ServiceBusReceiverClient receiver = new ServiceBusClientBuilder()
148+
.credential("<SERVICE-BUS-NAMESPACE-NAME>.servicebus.windows.net", credential)
149+
.receiver()
150+
.topicName("<TOPIC-NAME>")
151+
.subscriptionName("<SUBSCRIPTION-NAME>")
152+
.buildClient();
153+
```
154+
155+
**Sender client:**
127156

128157
```java
129158
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder()
@@ -156,7 +185,7 @@ Next, update your code to use passwordless connections.
156185
import com.azure.identity.DefaultAzureCredentialBuilder;
157186
```
158187

159-
1. Identify the locations in your code that currently create a `ServiceBusJmsConnectionFactory` to connect to Azure Service Bus. Update your code to match the following example:
188+
1. Identify the locations in your code that currently create a `ServiceBusJmsConnectionFactory` object to connect to Azure Service Bus. Update your code to match the following example:
160189

161190
```java
162191
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder()
@@ -209,7 +238,7 @@ Next, update your code to use passwordless connections.
209238
from azure.identity import DefaultAzureCredential
210239
```
211240
212-
1. Identify the locations in your code that create a `ServiceBusClient` to connect to Azure Service Bus. Update your code to match the following example:
241+
1. Identify the locations in your code that create a `ServiceBusClient` object to connect to Azure Service Bus. Update your code to match the following example:
213242
214243
```python
215244
credential = DefaultAzureCredential()

0 commit comments

Comments
 (0)