Skip to content

Commit

Permalink
Merge pull request #310 from azure-javaee/quarkus-azure-eventhub
Browse files Browse the repository at this point in the history
Quarkus azure eventhubs Extension
  • Loading branch information
backwind1233 authored Dec 25, 2024
2 parents 7fcf04a + 780cdb4 commit c8b657a
Show file tree
Hide file tree
Showing 30 changed files with 1,183 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.adoc text eol=lf
13 changes: 13 additions & 0 deletions .github/create-azure-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -Euo pipefail
# - APP_CONFIG_NAME
# - KEY_VAULT_NAME
# - COSMOSDB_ACCOUNT_NAME
# - EVENTHUBS_NAMESPACE
# - EVENTHUBS_EVENTHUB_NAME

# Create a resource group
az group create \
Expand Down Expand Up @@ -69,3 +71,14 @@ az cosmosdb create \
-g ${RESOURCE_GROUP_NAME} \
--default-consistency-level Session \
--locations regionName='West US' failoverPriority=0 isZoneRedundant=False

# Azure Event Hubs Extension
az eventhubs namespace create \
--name ${EVENTHUBS_NAMESPACE} \
--resource-group ${RESOURCE_GROUP_NAME}

az eventhubs eventhub create \
--name ${EVENTHUBS_EVENTHUB_NAME} \
--namespace-name ${EVENTHUBS_NAMESPACE} \
--resource-group ${RESOURCE_GROUP_NAME} \
--partition-count 2
1 change: 1 addition & 0 deletions .github/delete-azure-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ az appconfig delete --name "${APP_CONFIG_NAME}" --resource-group "${RESOURCE_GRO
az appconfig purge --name "${APP_CONFIG_NAME}" --yes
az keyvault delete --name "${KEY_VAULT_NAME}" --resource-group "${RESOURCE_GROUP_NAME}"
az keyvault purge --name "${KEY_VAULT_NAME}"
az eventhubs namespace delete --resource-group "${RESOURCE_GROUP_NAME}" --name "${EVENTHUBS_NAMESPACE}"
az group delete --name "${RESOURCE_GROUP_NAME}" --yes --no-wait
10 changes: 10 additions & 0 deletions .github/run-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ else
--role-definition-id 00000000-0000-0000-0000-000000000002
fi

# Azure Event Hubs Extension
OBJECT_ID=$(az ad sp list --filter "appId eq '$AZURE_CLIENT_ID'" --query '[0].id' -o tsv)
az role assignment create \
--role "Azure Event Hubs Data Owner" \
--assignee-object-id ${OBJECT_ID} \
--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_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
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and Integration Test

on:
push:
Expand Down Expand Up @@ -39,11 +39,13 @@ jobs:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
RESOURCE_GROUP_NAME: ${{ github.repository_owner }}-quarkus${{ github.run_id }}${{ github.run_number }}
RESOURCE_GROUP_NAME: ${{ github.repository_owner }}-quarkus${{ github.run_id }}-${{ github.run_number }}
STORAGE_ACCOUNT_NAME: storage${{ github.run_id }}${{ github.run_number }}
APP_CONFIG_NAME: appconfig${{ github.run_id }}${{ github.run_number }}
KEY_VAULT_NAME: kv${{ github.run_id }}${{ github.run_number }}
COSMOSDB_ACCOUNT_NAME: cosmos${{ github.run_id }}${{ github.run_number }}
APP_CONFIG_NAME: appconfig${{ github.run_id }}-${{ github.run_number }}
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_EVENTHUB_NAME: eventhubs-ehn-${{ github.run_id }}-${{ github.run_number }}
name: Build on ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Here's the current selection of Quarkus Azure Services:
- [Quarkus Azure Blob Storage Extension](https://docs.quarkiverse.io/quarkus-azure-services/dev/quarkus-azure-storage-blob.html): [Azure Blob Storage](https://azure.microsoft.com/products/storage/blobs/)
is a massively scalable and secure object storage for cloud-native workloads, archives, data lakes, high-performance
computing, and machine learning.
- [Quarkus Azure Event Hubs Extension](https://docs.quarkiverse.io/quarkus-azure-services/dev/quarkus-azure-eventhubs.html): [Azure Event Hubs](https://azure.microsoft.com/products/event-hubs)
is a big data streaming platform and event ingestion service. It can receive and process millions of events per second.

## Azure Services outside this repository
- [Quarkus Opentelemetry Exporter for Microsoft Azure](https://docs.quarkiverse.io/quarkus-opentelemetry-exporter/dev/quarkus-opentelemetry-exporter-azure.html) enables [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview) telemetry for Quarkus native applications
Expand All @@ -37,6 +39,7 @@ Example applications can be found inside the [integration-tests](integration-tes
- Load a secret from Azure Key Vault as property using `ConfigProperty`.
- [Azure Blob Storage sample](integration-tests/azure-storage-blob): REST endpoint using the Quarkus extension to
upload and download files to/from Azure Blob Storage.
- [Azure Event Hubs sample](integration-tests/azure-eventhubs): REST endpoint using the Quarkus extension to send/receive data to/from Azure Event Hubs.

## How to release a new version

Expand Down
10 changes: 10 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@
<artifactId>quarkus-azure-cosmos-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.azureservices</groupId>
<artifactId>quarkus-azure-eventhubs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.azureservices</groupId>
<artifactId>quarkus-azure-eventhubs-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.azureservices</groupId>
<artifactId>quarkus-azure-keyvault</artifactId>
Expand Down
79 changes: 79 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-azure-eventhubs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[.configuration-legend]
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime
[.configuration-reference.searchable, cols="80,.^10,.^10"]
|===

h|[.header-title]##Configuration property##
h|Type
h|Default

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-enabled]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-enabled[`quarkus.azure.eventhubs.enabled`]##

[.description]
--
The flag to enable the eventhubs. If set to false, the eventhubs will be disabled


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_ENABLED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_ENABLED+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`true`

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-namespace]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-namespace[`quarkus.azure.eventhubs.namespace`]##

[.description]
--
The namespace 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_NAMESPACE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_NAMESPACE+++`
endif::add-copy-button-to-env-var[]
--
|string
|required icon:exclamation-circle[title=Configuration property is required]

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

[.description]
--
The domain 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_DOMAIN_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_DOMAIN_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
|`servicebus.windows.net`

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_EVENTHUB_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
|required icon:exclamation-circle[title=Configuration property is required]

|===

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[.configuration-legend]
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime
[.configuration-reference.searchable, cols="80,.^10,.^10"]
|===

h|[.header-title]##Configuration property##
h|Type
h|Default

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-enabled]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-enabled[`quarkus.azure.eventhubs.enabled`]##

[.description]
--
The flag to enable the eventhubs. If set to false, the eventhubs will be disabled


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_AZURE_EVENTHUBS_ENABLED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_ENABLED+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`true`

a| [[quarkus-azure-eventhubs_quarkus-azure-eventhubs-namespace]] [.property-path]##link:#quarkus-azure-eventhubs_quarkus-azure-eventhubs-namespace[`quarkus.azure.eventhubs.namespace`]##

[.description]
--
The namespace 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_NAMESPACE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_NAMESPACE+++`
endif::add-copy-button-to-env-var[]
--
|string
|required icon:exclamation-circle[title=Configuration property is required]

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

[.description]
--
The domain 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_DOMAIN_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_DOMAIN_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
|`servicebus.windows.net`

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_EVENTHUB_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_AZURE_EVENTHUBS_EVENTHUB_NAME+++`
endif::add-copy-button-to-env-var[]
--
|string
|required icon:exclamation-circle[title=Configuration property is required]

|===

2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ include::quarkus-azure-cosmos.adoc[leveloffset=+1, opts=optional]
include::quarkus-azure-key-vault.adoc[leveloffset=+1, opts=optional]

include::quarkus-azure-storage-blob.adoc[leveloffset=+1, opts=optional]

include::quarkus-azure-eventhubs.adoc[leveloffset=+1, opts=optional]
Loading

0 comments on commit c8b657a

Please sign in to comment.