Skip to content

Update jms sample with passwordless connection #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ languages:
- java
products:
- azure-service-bus
name: Sending and Receiving Message by Azure Service Bus (Queue) And Jms in Spring Boot Application
description: This sample demonstrates how to send and receive message by Azure Service Bus (queue) and JMS in Spring Boot application.
name: Sending and Receiving Message by Azure Service Bus (Queue) And Jms in Spring Boot Application without Password
description: This sample demonstrates how to send and receive message by Azure Service Bus (queue) and JMS in Spring Boot application without password.
---

# Sending and Receiving Message by Azure Service Bus (Queue) And Jms in Spring Boot Application
# Sending and Receiving Message by Azure Service Bus (Queue) And Jms in Spring Boot Application without Password

This sample project demonstrates how to use Spring JMS for Azure Service Bus Queue via Spring Boot Starter `spring-cloud-azure-starter-servicebus-jms`.

Expand Down Expand Up @@ -140,7 +140,7 @@ terraform\setup_env.ps1
If you want to run the sample in debug mode, you can save the output value.

```shell
SERVICEBUS_NAMESPACE_CONNECTION_STRING=...
SERVICEBUS_NAMESPACE_NAME=...
PRICING_TIER=...
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spring:
jms:
servicebus:
connection-string: ${SERVICEBUS_NAMESPACE_CONNECTION_STRING}
namespace: ${SERVICEBUS_NAMESPACE_NAME}
passwordless-enabled: true
pricing-tier: ${PRICING_TIER}
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ resource "azurerm_servicebus_queue" "queue" {
requires_session = false
default_message_ttl = "P14D"
}

data "azurerm_client_config" "current" {
}

resource "azurerm_role_assignment" "role_servicebus_data_owner" {
scope = azurerm_servicebus_namespace.servicebus_namespace.id
role_definition_name = "Azure Service Bus Data Owner"
principal_id = data.azurerm_client_config.current.object_id
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output "SERVICEBUS_NAMESPACE_CONNECTION_STRING" {
value = azurerm_servicebus_namespace.servicebus_namespace.default_primary_connection_string
description = "The connection_string of servicebus namespace."
sensitive = true
output "SERVICEBUS_NAMESPACE_NAME" {
value = azurerm_servicebus_namespace.servicebus_namespace.name
description = "The name of service bus namespace."
}

output "PRICING_TIER" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$env:SERVICEBUS_NAMESPACE_CONNECTION_STRING=$(terraform -chdir=terraform output -raw SERVICEBUS_NAMESPACE_CONNECTION_STRING)
$env:SERVICEBUS_NAMESPACE_NAME=$(terraform -chdir=terraform output -raw SERVICEBUS_NAMESPACE_NAME)
$env:PRICING_TIER=$(terraform -chdir=terraform output -raw PRICING_TIER)

echo SERVICEBUS_NAMESPACE_CONNECTION_STRING=$env:SERVICEBUS_NAMESPACE_CONNECTION_STRING
echo SERVICEBUS_NAMESPACE_NAME=$env:SERVICEBUS_NAMESPACE_NAME
echo PRICING_TIER=$env:PRICING_TIER
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export SERVICEBUS_NAMESPACE_CONNECTION_STRING=$(terraform -chdir=./terraform output -raw SERVICEBUS_NAMESPACE_CONNECTION_STRING)
export SERVICEBUS_NAMESPACE_NAME=$(terraform -chdir=./terraform output -raw SERVICEBUS_NAMESPACE_NAME)
export PRICING_TIER=$(terraform -chdir=./terraform output -raw PRICING_TIER)

echo SERVICEBUS_NAMESPACE_CONNECTION_STRING=$SERVICEBUS_NAMESPACE_CONNECTION_STRING
echo SERVICEBUS_NAMESPACE_NAME=$SERVICEBUS_NAMESPACE_NAME
echo PRICING_TIER=$PRICING_TIER
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ terraform\setup_env.ps1
If you want to run the sample in debug mode, you can save the output value.

```shell
SERVICEBUS_NAMESPACE_CONNECTION_STRING=...
SERVICEBUS_NAMESPACE_NAME=...
PRICING_TIER=...
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
spring:
jms:
servicebus:
connection-string: ${SERVICEBUS_NAMESPACE_CONNECTION_STRING}
namespace: ${SERVICEBUS_NAMESPACE_NAME}
passwordless-enabled: true
pricing-tier: ${PRICING_TIER}
topic-client-id: topic-client-id
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ resource "azurerm_servicebus_subscription" "application" {

max_delivery_count = 1
}


data "azurerm_client_config" "current" {
}

resource "azurerm_role_assignment" "role_servicebus_data_owner" {
scope = azurerm_servicebus_namespace.servicebus_namespace.id
role_definition_name = "Azure Service Bus Data Owner"
principal_id = data.azurerm_client_config.current.object_id
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output "SERVICEBUS_NAMESPACE_CONNECTION_STRING" {
value = azurerm_servicebus_namespace.servicebus_namespace.default_primary_connection_string
description = "The connection_string of servicebus namespace."
sensitive = true
output "SERVICEBUS_NAMESPACE_NAME" {
value = azurerm_servicebus_namespace.servicebus_namespace.name
description = "The name of Service Bus namespace."
}

output "PRICING_TIER" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$env:SERVICEBUS_NAMESPACE_CONNECTION_STRING=$(terraform -chdir=terraform output -raw SERVICEBUS_NAMESPACE_CONNECTION_STRING)
$env:SERVICEBUS_NAMESPACE_NAME=$(terraform -chdir=terraform output -raw SERVICEBUS_NAMESPACE_NAME)
$env:PRICING_TIER=$(terraform -chdir=terraform output -raw PRICING_TIER)

echo SERVICEBUS_NAMESPACE_CONNECTION_STRING=$env:SERVICEBUS_NAMESPACE_CONNECTION_STRING
echo SERVICEBUS_NAMESPACE_NAME=$env:SERVICEBUS_NAMESPACE_NAME
echo PRICING_TIER=$env:PRICING_TIER
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export SERVICEBUS_NAMESPACE_CONNECTION_STRING=$(terraform -chdir=./terraform output -raw SERVICEBUS_NAMESPACE_CONNECTION_STRING)
export SERVICEBUS_NAMESPACE_NAME=$(terraform -chdir=./terraform output -raw SERVICEBUS_NAMESPACE_NAME)
export PRICING_TIER=$(terraform -chdir=./terraform output -raw PRICING_TIER)

echo SERVICEBUS_NAMESPACE_CONNECTION_STRING=$SERVICEBUS_NAMESPACE_CONNECTION_STRING
echo SERVICEBUS_NAMESPACE_NAME=$SERVICEBUS_NAMESPACE_NAME
echo PRICING_TIER=$PRICING_TIER