Skip to content
Merged
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
47 changes: 47 additions & 0 deletions azure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Azure Examples — Test Account Setup

Some Azure examples require a real Azure Storage account (e.g. blob versioning).
See each example's own README for how to run it.

## Prerequisites

- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) (`az`)
- An Azure subscription (a [free account](https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account) works)

## Create a Test Storage Account

```bash
# Login
az login

# Create a resource group (delete it when done to avoid charges)
az group create --name camel-test-rg --location northeurope

# Create a General-purpose v2 storage account
az storage account create \
--name cameltestblob \
--resource-group camel-test-rg \
--location northeurope \
--sku Standard_LRS \
--kind StorageV2

# Enable blob versioning (required for version ID operations)
az storage account blob-service-properties update \
--account-name cameltestblob \
--resource-group camel-test-rg \
--enable-versioning true

# Get the access key
az storage account keys list \
--account-name cameltestblob \
--resource-group camel-test-rg \
--query '[0].value' -o tsv
```

## Clean Up

Delete the resource group to remove all resources and stop billing:

```bash
az group delete --name camel-test-rg --yes
```
10 changes: 10 additions & 0 deletions azure/camel-example-spring-boot-azure-storage-blob/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This example demonstrates how to use the Apache Camel Azure Storage Blob compone
* Set and get blob index tags
* Find blobs by tag filter expressions
* Create and read blob snapshots
* List blob versions by version ID

=== Running Tests (Azurite)

Expand All @@ -28,6 +29,15 @@ To run against a real Azure Storage account:
export AZURE_STORAGE_CONTAINER_NAME=yourcontainer
mvn spring-boot:run

On startup the *version-demo* route uploads a blob twice and lists all versions with their version IDs:

=== Blob Version ID Demo ===
Uploaded version 1
Uploaded version 2
version-demo.txt -- versionId=2026-10-06T11:30:00.1234567Z
version-demo.txt -- versionId=2026-10-06T11:30:01.2345678Z
=== Demo complete ===

=== Help and Contributions

If you hit any problems please let us know on the https://camel.apache.org/community/mailing-list/[Camel Forums].
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package camel.sample;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;

import com.azure.storage.blob.BlobServiceClient;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.azure.storage.blob.BlobConstants;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class BlobVersionRouteBuilder extends RouteBuilder {

@Autowired
private BlobServiceClient serviceClient;

@Value("${azure.storage.container-name}")
private String containerName;

@Override
public void configure() {
from("timer:versionDemo?repeatCount=1&delay=0")
.routeId("version-demo")
.process(ex -> serviceClient.createBlobContainerIfNotExists(containerName))
.log("=== Blob Version ID Demo ===")
.setHeader(BlobConstants.BLOB_NAME, constant("version-demo.txt"))
.process(ex -> ex.getIn().setBody(
new ByteArrayInputStream("Hello Version 1".getBytes(StandardCharsets.UTF_8))))
.to("azure-storage-blob://{{azure.storage.account-name}}/{{azure.storage.container-name}}"
+ "?operation=uploadBlockBlob&serviceClient=#serviceClient")
.log("Uploaded version 1")
.removeHeaders("CamelAzureStorageBlob*")
.setHeader(BlobConstants.BLOB_NAME, constant("version-demo.txt"))
.process(ex -> ex.getIn().setBody(
new ByteArrayInputStream("Hello Version 2".getBytes(StandardCharsets.UTF_8))))
.to("azure-storage-blob://{{azure.storage.account-name}}/{{azure.storage.container-name}}"
+ "?operation=uploadBlockBlob&serviceClient=#serviceClient")
.log("Uploaded version 2")
.to("azure-storage-blob://{{azure.storage.account-name}}/{{azure.storage.container-name}}"
+ "?operation=listBlobVersions&serviceClient=#serviceClient")
.split(body())
.log(" ${body.name} -- versionId=${body.versionId}")
.end()
.log("=== Demo complete ===");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ azure:
storage:
account-name: ${AZURE_STORAGE_ACCOUNT_NAME:devstoreaccount1}
access-key: ${AZURE_STORAGE_ACCESS_KEY}
container-name: ${AZURE_STORAGE_CONTAINER_NAME:testcontainer}
container-name: ${AZURE_STORAGE_CONTAINER_NAME:yourcontainer}

camel:
component:
Expand Down
Loading