Skip to content

Commit

Permalink
Update event hub naming conventions for consistency across files.
Browse files Browse the repository at this point in the history
  • Loading branch information
backwind1233 committed Dec 24, 2024
1 parent 023c4b3 commit 780cdb4
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/create-azure-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -Euo pipefail
# - KEY_VAULT_NAME
# - COSMOSDB_ACCOUNT_NAME
# - EVENTHUBS_NAMESPACE
# - EVENTHUBS_EVENTHUBNAME
# - EVENTHUBS_EVENTHUB_NAME

# Create a resource group
az group create \
Expand Down Expand Up @@ -78,7 +78,7 @@ az eventhubs namespace create \
--resource-group ${RESOURCE_GROUP_NAME}

az eventhubs eventhub create \
--name ${EVENTHUBS_EVENTHUBNAME} \
--name ${EVENTHUBS_EVENTHUB_NAME} \
--namespace-name ${EVENTHUBS_NAMESPACE} \
--resource-group ${RESOURCE_GROUP_NAME} \
--partition-count 2
2 changes: 1 addition & 1 deletion .github/run-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ az role assignment create \
--scope "/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.EventHub/namespaces/${EVENTHUBS_NAMESPACE}"

export QUARKUS_AZURE_EVENTHUBS_NAMESPACE=${EVENTHUBS_NAMESPACE}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUBNAME=${EVENTHUBS_EVENTHUBNAME}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME=${EVENTHUBS_EVENTHUB_NAME}

# Run integration test with existing native executables against Azure services
mvn -B test-compile failsafe:integration-test -Dnative -Dazure.test=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
KEY_VAULT_NAME: kv${{ github.run_id }}-${{ github.run_number }}
COSMOSDB_ACCOUNT_NAME: cosmos${{ github.run_id }}-${{ github.run_number }}
EVENTHUBS_NAMESPACE: eventhubs-ns-${{ github.run_id }}-${{ github.run_number }}
EVENTHUBS_EVENTHUBNAME: eventhubs-ehn-${{ github.run_id }}-${{ github.run_number }}
EVENTHUBS_EVENTHUB_NAME: eventhubs-ehn-${{ github.run_id }}-${{ github.run_number }}
name: Build on ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/includes/quarkus-azure-eventhubs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ endif::add-copy-button-to-env-var[]
|string
|`servicebus.windows.net`

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-event-hub-name]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-event-hub-name[`quarkus.azure.eventhubs.event-hub-name`]##
a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-eventhub-name]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-eventhub-name[`quarkus.azure.eventhubs.eventhub-name`]##

[.description]
--
The name of the event hub. Required if quarkus.azure.eventhubs.enabled is set to true


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_EVENT_HUB_NAME+++[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENT_HUB_NAME+++`
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ endif::add-copy-button-to-env-var[]
|string
|`servicebus.windows.net`

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-event-hub-name]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-event-hub-name[`quarkus.azure.eventhubs.event-hub-name`]##
a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-eventhub-name]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-eventhub-name[`quarkus.azure.eventhubs.eventhub-name`]##

[.description]
--
The name of the event hub. Required if quarkus.azure.eventhubs.enabled is set to true


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_EVENT_HUB_NAME+++[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENT_HUB_NAME+++`
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/quarkus-azure-eventhubs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ Execute the following Azure CLI command to export the environment variables so t
[source,shell]
----
export QUARKUS_AZURE_EVENTHUBS_NAMESPACE=${EVENTHUBS_NAMESPACE}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUBNAME=${EVENTHUBS_EVENTHUBNAME}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME=${EVENTHUBS_EVENTHUB_NAME}
----

Because Quarkus implements the https://microprofile.io/project/eclipse/microprofile-config[MicroProfile Config specification], the value of the environment variables `QUARKUS_AZURE_EVENTHUBS_NAMESPACE` and `QUARKUS_AZURE_EVENTHUBS_EVENTHUBNAME` is read as if the properties `quarkus.azure.eventhubs.namespace` and `quarkus.azure.eventhubs.event-hub-name` were set in the `application.properties` file.
Because Quarkus implements the https://microprofile.io/project/eclipse/microprofile-config[MicroProfile Config specification], the value of the environment variables `QUARKUS_AZURE_EVENTHUBS_NAMESPACE` and `QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME` is read as if the properties `quarkus.azure.eventhubs.namespace` and `quarkus.azure.eventhubs.event-hub-name` were set in the `application.properties` file.

Although technically both approaches work, using environment variable is recommended and more secure as there's no risk of committing the connection string to source control.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private EventHubClientBuilder getBuilder() {
.credential(eventhubsConfig.namespace()
+ "."
+ eventhubsConfig.domainName(),
eventhubsConfig.eventHubName(),
eventhubsConfig.eventhubName(),
new DefaultAzureCredentialBuilder().build());
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public interface EventhubsConfig {
/**
* The name of the event hub. Required if quarkus.azure.eventhubs.enabled is set to true
*/
String eventHubName();
String eventhubName();
}
10 changes: 5 additions & 5 deletions integration-tests/azure-eventhubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ Run the following commands to create an Azure eventhub namespace and an eventhub

```
EVENTHUBS_NAMESPACE=<unique-eventhub-namespace-name>
EVENTHUBS_EVENTHUBNAME=<unique-eventhub-name>
EVENTHUBS_EVENTHUB_NAME=<unique-eventhub-name>
# Azure Event Hubs Extension
az eventhubs namespace create \
--name ${EVENTHUBS_NAMESPACE} \
--resource-group ${RESOURCE_GROUP_NAME}
az eventhubs eventhub create \
--name ${EVENTHUBS_EVENTHUBNAME} \
--name ${EVENTHUBS_EVENTHUB_NAME} \
--namespace-name ${EVENTHUBS_NAMESPACE} \
--resource-group ${RESOURCE_GROUP_NAME} \
--partition-count 2
export QUARKUS_AZURE_EVENTHUBS_NAMESPACE=${EVENTHUBS_NAMESPACE}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUBNAME=${EVENTHUBS_EVENTHUBNAME}
export QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME=${EVENTHUBS_EVENTHUB_NAME}
```

Expand All @@ -91,13 +91,13 @@ Assign the `Azure Event Hubs Data Owner` role to the signed-in user as a Microso
az role assignment create \
--role "Azure Event Hubs Data Owner" \
--assignee-object-id ${servicePrincipal} \
--scope "/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.EventHub/namespaces/${EVENTHUBS_NAMESPACE}/eventhubs/${EVENTHUBS_EVENTHUBNAME}"
--scope "/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.EventHub/namespaces/${EVENTHUBS_NAMESPACE}/eventhubs/${EVENTHUBS_EVENTHUB_NAME}"
```


## Running the sample

You have different choices to run the sample. Make sure you have followed [Preparing the Azure services](#preparing-the-azure-services) to create the required Azure services. Select an option and proceed to [Testing the sample](#testing-the-sample). For any choice, make sure the environment variable `QUARKUS_AZURE_EVENTHUBS_NAMESPACE` and `QUARKUS_AZURE_EVENTHUBS_EVENTHUBNAME` are defined correctly in the environment before starting Quarkus.
You have different choices to run the sample. Make sure you have followed [Preparing the Azure services](#preparing-the-azure-services) to create the required Azure services. Select an option and proceed to [Testing the sample](#testing-the-sample). For any choice, make sure the environment variable `QUARKUS_AZURE_EVENTHUBS_NAMESPACE` and `QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME` are defined correctly in the environment before starting Quarkus.

### Running the sample in development mode

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#quarkus.azure.eventhubs.namespace=
#quarkus.azure.eventhubs.event-hub-name=
#quarkus.azure.eventhubs.eventhub-name=

0 comments on commit 780cdb4

Please sign in to comment.