You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/03/31 10:27:34 UTC

[camel] branch master updated (3fafa5a -> 166a554)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 3fafa5a  CAMEL-14715 - More docs and upgrade
     new 14babe8  CAMEL-13462 - Override blob name using header implementation.
     new e51ac7c  CAMEL-13462 - remove some code that shouldn't be there.
     new b576c10  CAMEL-13462 - Remove unused imports. Rename override constant.
     new b802572  CAMEL-13462: Fix override blob header
     new 166a554  Regen

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/azure-blob-component.adoc        |  16 +-
 .../azure/blob/BlobHeadersConstants.java}          |   6 +-
 .../component/azure/blob/BlobServiceComponent.java |   4 +-
 .../component/azure/blob/BlobServiceProducer.java  | 197 ++++++++++++---------
 .../component/azure/blob/BlobServiceUtil.java      |  54 +++---
 .../azure/blob/BlobServiceAppendConsumerTest.java  |   8 +-
 .../azure/blob/BlobServiceBlockConsumerTest.java   |   8 +-
 ...lobServiceComponentConfigurationClientTest.java |   9 +-
 .../BlobServiceComponentConfigurationTest.java     |  11 +-
 .../BlobServiceProducerOverrideBlobNameTest.java}  |  45 ++---
 .../azure/blob/BlobServiceProducerSpringTest.java  |  31 +---
 .../component/azure/blob/BlobServiceUtilTest.java  |   8 +-
 .../azure/common/AzureCredentialsTest.java         |   6 +-
 .../azure/common/AzureServiceCommonTestUtil.java   |   6 +-
 .../azure/common/MissingCredentialsTest.java       |  12 +-
 ...eueServiceComponentClientConfigurationTest.java |   9 +-
 .../QueueServiceComponentConfigurationTest.java    |   9 +-
 .../modules/ROOT/pages/azure-blob-component.adoc   |  16 +-
 18 files changed, 235 insertions(+), 220 deletions(-)
 copy components/{camel-apns/src/main/java/org/apache/camel/component/apns/model/ConnectionStrategy.java => camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java} (84%)
 copy components/{camel-aws-ddb/src/test/java/org/apache/camel/component/aws/ddb/UpdateTableCommandTest.java => camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java} (51%)


[camel] 04/05: CAMEL-13462: Fix override blob header

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b8025724321d73b4fe4fc9e13227586c7f52eabd
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 31 12:19:43 2020 +0200

    CAMEL-13462: Fix override blob header
---
 .../src/main/docs/azure-blob-component.adoc        |  16 +-
 .../component/azure/blob/BlobHeadersConstants.java |   2 +-
 .../component/azure/blob/BlobServiceProducer.java  | 196 +++++++++++----------
 .../component/azure/blob/BlobServiceUtil.java      |  54 +++---
 .../BlobServiceProducerOverrideBlobNameTest.java   |   9 +-
 .../component/azure/blob/BlobServiceUtilTest.java  |   8 +-
 .../azure/common/AzureCredentialsTest.java         |   6 +-
 7 files changed, 162 insertions(+), 129 deletions(-)

diff --git a/components/camel-azure/src/main/docs/azure-blob-component.adoc b/components/camel-azure/src/main/docs/azure-blob-component.adoc
index 5d7c81c..726acfa 100644
--- a/components/camel-azure/src/main/docs/azure-blob-component.adoc
+++ b/components/camel-azure/src/main/docs/azure-blob-component.adoc
@@ -17,7 +17,7 @@ https://docs.microsoft.com/azure/[Azure Documentation Portal].
 
 == URI Format
 
-[source,java]
+[source,text]
 ------------------------------
 azure-blob://accountName/containerName[/blobName][?options]
 ------------------------------
@@ -234,6 +234,20 @@ from("azure-blob://" + accountName + "/" + containerName + "/" + fileName + "?az
 .to("mock:result");
 ----
 
+== Dynamic blob names
+
+The producer supports overriding the default blob name from a message header as shown below:
+
+[source,java]
+----
+   .setHeader("CamelAzureOverrideBlobName", constant("myNewBlob"))
+    .to("azure-blob://myacount/mycontainer/myblob")
+----
+
+Here the producer would normally use `myBlob` as the blob name, but the header will override this and use
+`myNewBlob` instead. This allow for dynamic blob names.
+
+
 == Dependencies
 
 Maven users will need to add the following dependency to their `pom.xml`.
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
index 941b1cc..d9f6743 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
@@ -18,6 +18,6 @@ package org.apache.camel.component.azure.blob;
 
 public interface BlobHeadersConstants {
 
-    String OVERRIDE_BLOB_NAME = "CamelOverrideBlobName";
+    String OVERRIDE_BLOB_NAME = "CamelAzureOverrideBlobName";
 
 }
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
index 1248dbd..cb05f4a 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
@@ -49,7 +49,7 @@ import org.apache.camel.util.URISupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
+import static org.apache.camel.component.azure.blob.BlobServiceUtil.getBlobName;
 
 /**
  * A Producer which sends messages to the Azure Storage Blob Service
@@ -64,64 +64,60 @@ public class BlobServiceProducer extends DefaultProducer {
 
     @Override
     public void process(final Exchange exchange) throws Exception {
-
-        overrideBlobName(exchange);
-
         BlobServiceOperations operation = determineOperation(exchange);
         if (ObjectHelper.isEmpty(operation)) {
             operation = BlobServiceOperations.listBlobs;
-        } else {
-            switch (operation) {
-                case getBlob:
-                    getBlob(exchange);
-                    break;
-                case deleteBlob:
-                    deleteBlob(exchange);
-                    break;
-                case listBlobs:
-                    listBlobs(exchange);
-                    break;
-                case updateBlockBlob:
-                    updateBlockBlob(exchange);
-                    break;
-                case uploadBlobBlocks:
-                    uploadBlobBlocks(exchange);
-                    break;
-                case commitBlobBlockList:
-                    commitBlobBlockList(exchange);
-                    break;
-                case getBlobBlockList:
-                    getBlobBlockList(exchange);
-                    break;
-                case createAppendBlob:
-                    createAppendBlob(exchange);
-                    break;
-                case updateAppendBlob:
-                    updateAppendBlob(exchange);
-                    break;
-                case createPageBlob:
-                    createPageBlob(exchange);
-                    break;
-                case updatePageBlob:
-                    uploadPageBlob(exchange);
-                    break;
-                case resizePageBlob:
-                    resizePageBlob(exchange);
-                    break;
-                case clearPageBlob:
-                    clearPageBlob(exchange);
-                    break;
-                case getPageBlobRanges:
-                    getPageBlobRanges(exchange);
-                    break;
-                default:
-                    throw new IllegalArgumentException("Unsupported operation");
-            }
+        }
+        switch (operation) {
+            case getBlob:
+                getBlob(exchange);
+                break;
+            case deleteBlob:
+                deleteBlob(exchange);
+                break;
+            case listBlobs:
+                listBlobs(exchange);
+                break;
+            case updateBlockBlob:
+                updateBlockBlob(exchange);
+                break;
+            case uploadBlobBlocks:
+                uploadBlobBlocks(exchange);
+                break;
+            case commitBlobBlockList:
+                commitBlobBlockList(exchange);
+                break;
+            case getBlobBlockList:
+                getBlobBlockList(exchange);
+                break;
+            case createAppendBlob:
+                createAppendBlob(exchange);
+                break;
+            case updateAppendBlob:
+                updateAppendBlob(exchange);
+                break;
+            case createPageBlob:
+                createPageBlob(exchange);
+                break;
+            case updatePageBlob:
+                uploadPageBlob(exchange);
+                break;
+            case resizePageBlob:
+                resizePageBlob(exchange);
+                break;
+            case clearPageBlob:
+                clearPageBlob(exchange);
+                break;
+            case getPageBlobRanges:
+                getPageBlobRanges(exchange);
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported operation");
         }
     }
 
     private void listBlobs(Exchange exchange) throws Exception {
-        CloudBlobContainer client = BlobServiceUtil.createBlobContainerClient(getConfiguration());
+        CloudBlobContainer client = BlobServiceUtil.createBlobContainerClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         LOG.trace("Getting the blob list from the container [{}] from exchange [{}]...",
                 getConfiguration().getContainerName(), exchange);
@@ -142,13 +138,16 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void updateBlockBlob(Exchange exchange) throws Exception {
-        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(getConfiguration());
+        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration());
         configureCloudBlobForWrite(client);
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
 
         InputStream inputStream = getInputStreamFromExchange(exchange);
 
-        LOG.trace("Putting a block blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Putting a block blob [{}] from exchange [{}]...", blobName, exchange);
+        }
         try {
             client.upload(inputStream, -1,
                     opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext());
@@ -170,11 +169,14 @@ public class BlobServiceProducer extends DefaultProducer {
             throw new IllegalArgumentException("Illegal storageBlocks payload");
         }
 
-        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(getConfiguration());
+        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration());
         configureCloudBlobForWrite(client);
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
 
-        LOG.trace("Putting a blob [{}] from blocks from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Putting a blob [{}] from blocks from exchange [{}]...", blobName, exchange);
+        }
         List<BlockEntry> blockEntries = new LinkedList<>();
         for (BlobBlock blobBlock : blobBlocks) {
             blockEntries.add(blobBlock.getBlockEntry());
@@ -202,10 +204,13 @@ public class BlobServiceProducer extends DefaultProducer {
             throw new IllegalArgumentException("Illegal commit block list payload");
         }
 
-        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(getConfiguration());
+        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
 
-        LOG.trace("Putting a blob [{}] block list from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Putting a blob [{}] block list from exchange [{}]...", blobName, exchange);
+        }
         client.commitBlockList(blockEntries,
                 opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext());
     }
@@ -231,9 +236,12 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void getBlobBlockList(Exchange exchange) throws Exception {
-        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(getConfiguration());
+        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
-        LOG.trace("Getting the blob block list [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Getting the blob block list [{}] from exchange [{}]...", blobName, exchange);
+        }
         BlockListingFilter filter = exchange.getIn().getBody(BlockListingFilter.class);
         if (filter == null) {
             filter = BlockListingFilter.COMMITTED;
@@ -244,12 +252,12 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void deleteBlockBlob(Exchange exchange) throws Exception {
-        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(getConfiguration());
+        CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration());
         doDeleteBlock(client, exchange);
     }
 
     private void createAppendBlob(Exchange exchange) throws Exception {
-        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(getConfiguration());
+        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         if (opts.getAccessCond() == null) {
             // Default: do not reset the blob content if the blob already exists
@@ -260,7 +268,10 @@ public class BlobServiceProducer extends DefaultProducer {
 
     private void doCreateAppendBlob(CloudAppendBlob client, BlobServiceRequestOptions opts, Exchange exchange)
             throws Exception {
-        LOG.trace("Creating an append blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Creating an append blob [{}] from exchange [{}]...", blobName, exchange);
+        }
         try {
             client.createOrReplace(opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext());
         } catch (StorageException ex) {
@@ -273,7 +284,7 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void updateAppendBlob(Exchange exchange) throws Exception {
-        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(getConfiguration());
+        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration());
         configureCloudBlobForWrite(client);
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         if (opts.getAccessCond() == null) {
@@ -297,13 +308,13 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void deleteAppendBlob(Exchange exchange) throws Exception {
-        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(getConfiguration());
+        CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration());
         doDeleteBlock(client, exchange);
     }
 
 
     private void createPageBlob(Exchange exchange) throws Exception {
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         if (opts.getAccessCond() == null) {
             // Default: do not reset the blob content if the blob already exists
@@ -314,7 +325,10 @@ public class BlobServiceProducer extends DefaultProducer {
 
     private void doCreatePageBlob(CloudPageBlob client, BlobServiceRequestOptions opts, Exchange exchange)
             throws Exception {
-        LOG.trace("Creating a page blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Creating a page blob [{}] from exchange [{}]...", blobName, exchange);
+        }
         Long pageSize = getPageBlobSize(exchange);
         try {
             client.create(pageSize,
@@ -330,9 +344,12 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void uploadPageBlob(Exchange exchange) throws Exception {
-        LOG.trace("Updating a page blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Updating a page blob [{}] from exchange [{}]...", blobName, exchange);
+        }
 
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         configureCloudBlobForWrite(client);
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         if (opts.getAccessCond() == null) {
@@ -351,18 +368,24 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void resizePageBlob(Exchange exchange) throws Exception {
-        LOG.trace("Resizing a page blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Resizing a page blob [{}] from exchange [{}]...", blobName, exchange);
+        }
 
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
         Long pageSize = getPageBlobSize(exchange);
         client.resize(pageSize, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext());
     }
 
     private void clearPageBlob(Exchange exchange) throws Exception {
-        LOG.trace("Clearing a page blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Clearing a page blob [{}] from exchange [{}]...", blobName, exchange);
+        }
 
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
 
         Long blobOffset = getConfiguration().getBlobOffset();
@@ -402,17 +425,20 @@ public class BlobServiceProducer extends DefaultProducer {
     }
 
     private void getPageBlobRanges(Exchange exchange) throws Exception {
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         BlobServiceUtil.configureCloudBlobForRead(client, getConfiguration());
         BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange);
-        LOG.trace("Getting the page blob ranges [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Getting the page blob ranges [{}] from exchange [{}]...", blobName, exchange);
+        }
         List<PageRange> ranges =
                 client.downloadPageRanges(opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext());
         ExchangeUtil.getMessageForResponse(exchange).setBody(ranges);
     }
 
     private void deletePageBlob(Exchange exchange) throws Exception {
-        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration());
+        CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration());
         doDeleteBlock(client, exchange);
     }
 
@@ -426,15 +452,13 @@ public class BlobServiceProducer extends DefaultProducer {
 
 
     private void doDeleteBlock(CloudBlob client, Exchange exchange) throws Exception {
-        LOG.trace("Deleting a blob [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange);
+        if (LOG.isTraceEnabled()) {
+            String blobName = getBlobName(exchange, getConfiguration());
+            LOG.trace("Deleting a blob [{}] from exchange [{}]...", blobName, exchange);
+        }
         client.delete();
     }
 
-    private String getCharsetName(Exchange exchange) {
-        String charset = exchange.getIn().getHeader(Exchange.CHARSET_NAME, String.class);
-        return charset == null ? "UTF-8" : charset;
-    }
-
     private void configureCloudBlobForWrite(CloudBlob client) {
         if (getConfiguration().getStreamWriteSize() > 0) {
             client.setStreamWriteSizeInBytes(getConfiguration().getStreamWriteSize());
@@ -500,12 +524,4 @@ public class BlobServiceProducer extends DefaultProducer {
         }
     }
 
-
-    private void overrideBlobName(Exchange exchange) {
-        String blobName = exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, String.class);
-
-        if (ObjectHelper.isNotEmpty(blobName)) {
-            getEndpoint().getConfiguration().setBlobName(blobName);
-        }
-    }
 }
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
index c4084e9..99ad8c2 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
@@ -37,6 +37,9 @@ import org.apache.camel.component.azure.common.ExchangeUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
+import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
+
 public final class BlobServiceUtil {
 
     private static final Logger LOG = LoggerFactory.getLogger(BlobServiceUtil.class);
@@ -63,17 +66,17 @@ public final class BlobServiceUtil {
 
     private static void getBlockBlob(Exchange exchange, BlobServiceConfiguration cfg)
             throws Exception {
-        CloudBlockBlob client = createBlockBlobClient(cfg);
+        CloudBlockBlob client = createBlockBlobClient(exchange, cfg);
         doGetBlob(client, exchange, cfg);
     }
 
     private static void getAppendBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception {
-        CloudAppendBlob client = createAppendBlobClient(cfg);
+        CloudAppendBlob client = createAppendBlobClient(exchange, cfg);
         doGetBlob(client, exchange, cfg);
     }
 
     private static void getPageBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception {
-        CloudPageBlob client = createPageBlobClient(cfg);
+        CloudPageBlob client = createPageBlobClient(exchange, cfg);
         doGetBlob(client, exchange, cfg);
     }
 
@@ -121,47 +124,47 @@ public final class BlobServiceUtil {
         return cfg.getBlobName()  + ".blob";
     }
 
-    public static CloudBlobContainer createBlobContainerClient(BlobServiceConfiguration cfg)
+    public static CloudBlobContainer createBlobContainerClient(Exchange exchange, BlobServiceConfiguration cfg)
             throws Exception {
-        URI uri = prepareStorageBlobUri(cfg, false);
+        URI uri = prepareStorageBlobUri(exchange, cfg, false);
         StorageCredentials creds = cfg.getAccountCredentials();
         return new CloudBlobContainer(uri, creds);
     }
 
-    public static CloudBlockBlob createBlockBlobClient(BlobServiceConfiguration cfg)
+    public static CloudBlockBlob createBlockBlobClient(Exchange exchange, BlobServiceConfiguration cfg)
             throws Exception {
-        CloudBlockBlob client = (CloudBlockBlob) getConfiguredClient(cfg);
+        CloudBlockBlob client = (CloudBlockBlob) getConfiguredClient(exchange, cfg);
         if (client == null) {
-            URI uri = prepareStorageBlobUri(cfg);
+            URI uri = prepareStorageBlobUri(exchange, cfg);
             StorageCredentials creds = cfg.getAccountCredentials();
             client = new CloudBlockBlob(uri, creds);
         }
         return client;
     }
 
-    public static CloudAppendBlob createAppendBlobClient(BlobServiceConfiguration cfg)
+    public static CloudAppendBlob createAppendBlobClient(Exchange exchange, BlobServiceConfiguration cfg)
             throws Exception {
-        CloudAppendBlob client = (CloudAppendBlob) getConfiguredClient(cfg);
+        CloudAppendBlob client = (CloudAppendBlob) getConfiguredClient(exchange, cfg);
         if (client == null) {
-            URI uri = prepareStorageBlobUri(cfg);
+            URI uri = prepareStorageBlobUri(exchange, cfg);
             StorageCredentials creds = cfg.getAccountCredentials();
             client = new CloudAppendBlob(uri, creds);
         }
         return client;
     }
 
-    public static CloudPageBlob createPageBlobClient(BlobServiceConfiguration cfg)
+    public static CloudPageBlob createPageBlobClient(Exchange exchange, BlobServiceConfiguration cfg)
             throws Exception {
-        CloudPageBlob client = (CloudPageBlob) getConfiguredClient(cfg);
+        CloudPageBlob client = (CloudPageBlob) getConfiguredClient(exchange, cfg);
         if (client == null) {
-            URI uri = prepareStorageBlobUri(cfg);
+            URI uri = prepareStorageBlobUri(exchange, cfg);
             StorageCredentials creds = cfg.getAccountCredentials();
             client = new CloudPageBlob(uri, creds);
         }
         return client;
     }
 
-    public static CloudBlob getConfiguredClient(BlobServiceConfiguration cfg) {
+    public static CloudBlob getConfiguredClient(Exchange exchange, BlobServiceConfiguration cfg) {
         CloudBlob client = cfg.getAzureBlobClient();
         if (client != null) {
             Class<?> expectedCls = null;
@@ -175,7 +178,7 @@ public final class BlobServiceUtil {
             if (client.getClass() != expectedCls) {
                 throw new IllegalArgumentException("Invalid Client Type");
             }
-            if (!client.getUri().equals(prepareStorageBlobUri(cfg))) {
+            if (!client.getUri().equals(prepareStorageBlobUri(exchange, cfg))) {
                 throw new IllegalArgumentException("Invalid Client URI");
             }
         }
@@ -188,12 +191,14 @@ public final class BlobServiceUtil {
         }
     }
 
-    public static URI prepareStorageBlobUri(BlobServiceConfiguration cfg) {
-        return prepareStorageBlobUri(cfg, true);
+    public static URI prepareStorageBlobUri(Exchange exchange, BlobServiceConfiguration cfg) {
+        return prepareStorageBlobUri(exchange, cfg, true);
     }
 
-    public static URI prepareStorageBlobUri(BlobServiceConfiguration cfg, boolean blobNameRequired) {
-        if (blobNameRequired && cfg.getBlobName() == null) {
+    public static URI prepareStorageBlobUri(Exchange exchange, BlobServiceConfiguration cfg, boolean blobNameRequired) {
+        String blobName = getBlobName(exchange, cfg);
+
+        if (blobNameRequired && blobName == null) {
             throw new IllegalArgumentException("Blob name must be specified");
         }
 
@@ -203,9 +208,9 @@ public final class BlobServiceUtil {
                 .append(BlobServiceConstants.SERVICE_URI_SEGMENT)
                 .append("/")
                 .append(cfg.getContainerName());
-        if (cfg.getBlobName() != null) {
+        if (blobName != null) {
             uriBuilder.append("/")
-                    .append(cfg.getBlobName());
+                    .append(blobName);
         }
         return URI.create(uriBuilder.toString());
     }
@@ -230,4 +235,9 @@ public final class BlobServiceUtil {
         opts.setRequestOpts(requestOpts);
         return opts;
     }
+
+    public static String getBlobName(Exchange exchange, BlobServiceConfiguration cfg) {
+        return exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, cfg.getBlobName(), String.class);
+    }
+
 }
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java
index 869c0b2..0a4ba77 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java
@@ -24,7 +24,6 @@ import org.junit.Before;
 import org.junit.Test;
 
 import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
-import static org.junit.Assert.assertEquals;
 
 public class BlobServiceProducerOverrideBlobNameTest {
 
@@ -41,24 +40,18 @@ public class BlobServiceProducerOverrideBlobNameTest {
 
     @Test
     public void testOverrideBlobName() throws Exception {
-
-        String blobName = "blobName";
+        String blobName = "myBlobName";
         exchange.getIn().setHeader(OVERRIDE_BLOB_NAME, blobName);
 
         producer.process(exchange);
-
-        assertEquals(blobName, producer.getEndpoint().getConfiguration().getBlobName());
     }
 
     @Test
     public void testSetBlobNameFromEndpoint() throws Exception {
-
         String blobName = "blob";
         exchange.getIn().setHeader(OVERRIDE_BLOB_NAME, blobName);
 
         producer.process(exchange);
-
-        assertEquals(blobName, producer.getEndpoint().getConfiguration().getBlobName());
     }
 
 }
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java
index f163c7c..fe8b3f1 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java
@@ -34,7 +34,7 @@ public class BlobServiceUtilTest extends CamelTestSupport {
         BlobServiceEndpoint endpoint =
             (BlobServiceEndpoint) context.getEndpoint("azure-blob://camelazure/container/blob?credentials=#creds");
         URI uri = 
-            BlobServiceUtil.prepareStorageBlobUri(endpoint.getConfiguration());
+            BlobServiceUtil.prepareStorageBlobUri(endpoint.createExchange(), endpoint.getConfiguration());
         assertEquals("https://camelazure.blob.core.windows.net/container/blob", uri.toString());
     }
 
@@ -47,7 +47,7 @@ public class BlobServiceUtilTest extends CamelTestSupport {
         
         BlobServiceEndpoint endpoint =
             (BlobServiceEndpoint) context.getEndpoint("azure-blob://camelazure/container/blob?azureBlobClient=#azureBlobClient&publicForRead=true");
-        assertSame(client, BlobServiceUtil.getConfiguredClient(endpoint.getConfiguration()));
+        assertSame(client, BlobServiceUtil.getConfiguredClient(endpoint.createExchange(), endpoint.getConfiguration()));
     }
     @Test
     public void testGetConfiguredClientTypeMismatch() throws Exception {
@@ -60,7 +60,7 @@ public class BlobServiceUtilTest extends CamelTestSupport {
             (BlobServiceEndpoint) context.getEndpoint("azure-blob://camelazure/container/blob?azureBlobClient=#azureBlobClient&publicForRead=true"
                                                            + "&blobType=appendBlob");
         try {
-            BlobServiceUtil.getConfiguredClient(endpoint.getConfiguration());
+            BlobServiceUtil.getConfiguredClient(endpoint.createExchange(), endpoint.getConfiguration());
             fail();
         } catch (IllegalArgumentException ex) {
             assertEquals("Invalid Client Type", ex.getMessage());
@@ -77,7 +77,7 @@ public class BlobServiceUtilTest extends CamelTestSupport {
             (BlobServiceEndpoint) context.getEndpoint("azure-blob://camelazure/container/blob2?azureBlobClient=#azureBlobClient&publicForRead=true"
                                                            + "&blobType=appendBlob");
         try {
-            BlobServiceUtil.getConfiguredClient(endpoint.getConfiguration());
+            BlobServiceUtil.getConfiguredClient(endpoint.createExchange(), endpoint.getConfiguration());
             fail();
         } catch (IllegalArgumentException ex) {
             assertEquals("Invalid Client URI", ex.getMessage());
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureCredentialsTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureCredentialsTest.java
index 88a7be9..53e2aa8 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureCredentialsTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureCredentialsTest.java
@@ -186,15 +186,15 @@ public class AzureCredentialsTest extends CamelTestSupport {
     private void executeBlobAssertions(String uriString, String expectedAccountName, String  expectedAccountKey) throws Exception {
         BlobServiceEndpoint endpoint = (BlobServiceEndpoint) context.getEndpoint(uriString);
 
-        CloudBlob pageBlobClient = BlobServiceUtil.createPageBlobClient(endpoint.getConfiguration());
+        CloudBlob pageBlobClient = BlobServiceUtil.createPageBlobClient(endpoint.createExchange(), endpoint.getConfiguration());
         executeBlobAccountCredentialsAssertion(pageBlobClient, endpoint.getConfiguration());
         executeBlobCredentialsAssertion(pageBlobClient, expectedAccountName, expectedAccountKey);
 
-        CloudBlob blockBlobClient = BlobServiceUtil.createBlockBlobClient(endpoint.getConfiguration());
+        CloudBlob blockBlobClient = BlobServiceUtil.createBlockBlobClient(endpoint.createExchange(), endpoint.getConfiguration());
         executeBlobAccountCredentialsAssertion(blockBlobClient, endpoint.getConfiguration());
         executeBlobCredentialsAssertion(blockBlobClient, expectedAccountName, expectedAccountKey);
 
-        CloudBlob appendBlobClient = BlobServiceUtil.createAppendBlobClient(endpoint.getConfiguration());
+        CloudBlob appendBlobClient = BlobServiceUtil.createAppendBlobClient(endpoint.createExchange(), endpoint.getConfiguration());
         executeBlobAccountCredentialsAssertion(appendBlobClient, endpoint.getConfiguration());
         executeBlobCredentialsAssertion(appendBlobClient, expectedAccountName, expectedAccountKey);
     }


[camel] 02/05: CAMEL-13462 - remove some code that shouldn't be there.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e51ac7c42c7c3119ca8e2d4dd2bd2f76175d3dc5
Author: blanx <dj...@gmail.com>
AuthorDate: Wed Mar 25 22:28:35 2020 +0100

    CAMEL-13462 - remove some code that shouldn't be there.
---
 .../component/azure/blob/BlobServiceComponent.java | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
index 2e7a250..6483226 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
@@ -63,22 +63,16 @@ public class BlobServiceComponent extends DefaultComponent {
         configuration.setAccountName(parts[0]);
         configuration.setContainerName(parts[1]);
 
-        String blobName = (String) parameters.get(OVERRIDE_BLOB_NAME);
-
-        if (StringUtils.isEmpty(blobName)) {
-            if (parts.length > 2) {
-                // Blob names can contain forward slashes
-                StringBuilder sb = new StringBuilder();
-                for (int i = 2; i < parts.length; i++) {
-                    sb.append(parts[i]);
-                    if (i + 1 < parts.length) {
-                        sb.append('/');
-                    }
+        if (parts.length > 2) {
+            // Blob names can contain forward slashes
+            StringBuilder sb = new StringBuilder();
+            for (int i = 2; i < parts.length; i++) {
+                sb.append(parts[i]);
+                if (i + 1 < parts.length) {
+                    sb.append('/');
                 }
-                configuration.setBlobName(sb.toString());
             }
-        } else {
-            configuration.setBlobName(blobName);
+            configuration.setBlobName(sb.toString());
         }
 
         BlobServiceEndpoint endpoint = new BlobServiceEndpoint(uri, this, configuration);


[camel] 03/05: CAMEL-13462 - Remove unused imports. Rename override constant.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b576c10c6cbaa7e71a7076b7bf7c5b65019edffd
Author: blanx <dj...@gmail.com>
AuthorDate: Thu Mar 26 08:02:10 2020 +0100

    CAMEL-13462 - Remove unused imports. Rename override constant.
---
 .../org/apache/camel/component/azure/blob/BlobHeadersConstants.java   | 2 +-
 .../org/apache/camel/component/azure/blob/BlobServiceComponent.java   | 3 ---
 .../org/apache/camel/component/azure/blob/BlobServiceProducer.java    | 4 +---
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
index 91d87fc..941b1cc 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
@@ -18,6 +18,6 @@ package org.apache.camel.component.azure.blob;
 
 public interface BlobHeadersConstants {
 
-    String OVERRIDE_BLOB_NAME = "overrideBlobName";
+    String OVERRIDE_BLOB_NAME = "CamelOverrideBlobName";
 
 }
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
index 6483226..2a2137f 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
@@ -27,9 +27,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.commons.lang3.StringUtils;
-
-import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
 
 @Component("azure-blob")
 public class BlobServiceComponent extends DefaultComponent {
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
index 44eea8a..1248dbd 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
@@ -46,7 +46,6 @@ import org.apache.camel.component.azure.common.ExchangeUtil;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
-import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -505,9 +504,8 @@ public class BlobServiceProducer extends DefaultProducer {
     private void overrideBlobName(Exchange exchange) {
         String blobName = exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, String.class);
 
-        if (StringUtils.isNotEmpty(blobName)) {
+        if (ObjectHelper.isNotEmpty(blobName)) {
             getEndpoint().getConfiguration().setBlobName(blobName);
         }
     }
-
 }


[camel] 05/05: Regen

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 166a554a923e8f0ec6afd2318972d268dda33a56
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 31 12:27:11 2020 +0200

    Regen
---
 .../modules/ROOT/pages/azure-blob-component.adoc         | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/docs/components/modules/ROOT/pages/azure-blob-component.adoc b/docs/components/modules/ROOT/pages/azure-blob-component.adoc
index 7a63242..8d49d15 100644
--- a/docs/components/modules/ROOT/pages/azure-blob-component.adoc
+++ b/docs/components/modules/ROOT/pages/azure-blob-component.adoc
@@ -18,7 +18,7 @@ https://docs.microsoft.com/azure/[Azure Documentation Portal].
 
 == URI Format
 
-[source,java]
+[source,text]
 ------------------------------
 azure-blob://accountName/containerName[/blobName][?options]
 ------------------------------
@@ -235,6 +235,20 @@ from("azure-blob://" + accountName + "/" + containerName + "/" + fileName + "?az
 .to("mock:result");
 ----
 
+== Dynamic blob names
+
+The producer supports overriding the default blob name from a message header as shown below:
+
+[source,java]
+----
+   .setHeader("CamelAzureOverrideBlobName", constant("myNewBlob"))
+    .to("azure-blob://myacount/mycontainer/myblob")
+----
+
+Here the producer would normally use `myBlob` as the blob name, but the header will override this and use
+`myNewBlob` instead. This allow for dynamic blob names.
+
+
 == Dependencies
 
 Maven users will need to add the following dependency to their `pom.xml`.


[camel] 01/05: CAMEL-13462 - Override blob name using header implementation.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 14babe8d1fd49f0beb128ac3203db7f26910c210
Author: blanx <dj...@gmail.com>
AuthorDate: Wed Mar 25 22:21:30 2020 +0100

    CAMEL-13462 - Override blob name using header implementation.
---
 .../component/azure/blob/BlobHeadersConstants.java | 23 ++++++++
 .../component/azure/blob/BlobServiceComponent.java | 29 ++++++----
 .../component/azure/blob/BlobServiceProducer.java  | 27 +++++++--
 .../azure/blob/BlobServiceAppendConsumerTest.java  |  8 +--
 .../azure/blob/BlobServiceBlockConsumerTest.java   |  8 +--
 ...lobServiceComponentConfigurationClientTest.java |  9 +--
 .../BlobServiceComponentConfigurationTest.java     | 11 +---
 .../BlobServiceProducerOverrideBlobNameTest.java   | 64 ++++++++++++++++++++++
 .../azure/blob/BlobServiceProducerSpringTest.java  | 31 ++---------
 .../azure/common/AzureServiceCommonTestUtil.java   |  6 +-
 .../azure/common/MissingCredentialsTest.java       | 12 ++--
 ...eueServiceComponentClientConfigurationTest.java |  9 +--
 .../QueueServiceComponentConfigurationTest.java    |  9 +--
 13 files changed, 151 insertions(+), 95 deletions(-)

diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
new file mode 100644
index 0000000..91d87fc
--- /dev/null
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobHeadersConstants.java
@@ -0,0 +1,23 @@
+/*
+ * 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 org.apache.camel.component.azure.blob;
+
+public interface BlobHeadersConstants {
+
+    String OVERRIDE_BLOB_NAME = "overrideBlobName";
+
+}
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
index b9149ca..2e7a250 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceComponent.java
@@ -27,11 +27,14 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
+import org.apache.commons.lang3.StringUtils;
+
+import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
 
 @Component("azure-blob")
 public class BlobServiceComponent extends DefaultComponent {
 
-    public static final String MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE =
+    public static final String MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE =
             "One of azureBlobClient, credentials or both credentialsAccountName and credentialsAccountKey must be specified";
 
     @Metadata(label = "advanced")
@@ -60,16 +63,22 @@ public class BlobServiceComponent extends DefaultComponent {
         configuration.setAccountName(parts[0]);
         configuration.setContainerName(parts[1]);
 
-        if (parts.length > 2) {
-            // Blob names can contain forward slashes
-            StringBuilder sb = new StringBuilder();
-            for (int i = 2; i < parts.length; i++) {
-                sb.append(parts[i]);
-                if (i + 1 < parts.length) {
-                    sb.append('/');
+        String blobName = (String) parameters.get(OVERRIDE_BLOB_NAME);
+
+        if (StringUtils.isEmpty(blobName)) {
+            if (parts.length > 2) {
+                // Blob names can contain forward slashes
+                StringBuilder sb = new StringBuilder();
+                for (int i = 2; i < parts.length; i++) {
+                    sb.append(parts[i]);
+                    if (i + 1 < parts.length) {
+                        sb.append('/');
+                    }
                 }
+                configuration.setBlobName(sb.toString());
             }
-            configuration.setBlobName(sb.toString());
+        } else {
+            configuration.setBlobName(blobName);
         }
 
         BlobServiceEndpoint endpoint = new BlobServiceEndpoint(uri, this, configuration);
@@ -99,7 +108,7 @@ public class BlobServiceComponent extends DefaultComponent {
         StorageCredentials creds = client == null ? cfg.getAccountCredentials()
                 : client.getServiceClient().getCredentials();
         if ((creds == null || creds instanceof StorageCredentialsAnonymous) && !cfg.isPublicForRead()) {
-            throw new IllegalArgumentException(MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+            throw new IllegalArgumentException(MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
         }
     }
 
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
index 5def549..44eea8a 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java
@@ -46,9 +46,12 @@ import org.apache.camel.component.azure.common.ExchangeUtil;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
+
 /**
  * A Producer which sends messages to the Azure Storage Blob Service
  */
@@ -62,6 +65,9 @@ public class BlobServiceProducer extends DefaultProducer {
 
     @Override
     public void process(final Exchange exchange) throws Exception {
+
+        overrideBlobName(exchange);
+
         BlobServiceOperations operation = determineOperation(exchange);
         if (ObjectHelper.isEmpty(operation)) {
             operation = BlobServiceOperations.listBlobs;
@@ -125,10 +131,10 @@ public class BlobServiceProducer extends DefaultProducer {
         Object detailsObject = exchange.getIn().getHeader(BlobServiceConstants.BLOB_LISTING_DETAILS);
         if (detailsObject instanceof EnumSet) {
             @SuppressWarnings("unchecked")
-            EnumSet<BlobListingDetails> theDetails = (EnumSet<BlobListingDetails>)detailsObject;
+            EnumSet<BlobListingDetails> theDetails = (EnumSet<BlobListingDetails>) detailsObject;
             details = theDetails;
         } else if (detailsObject instanceof BlobListingDetails) {
-            details = EnumSet.of((BlobListingDetails)detailsObject);
+            details = EnumSet.of((BlobListingDetails) detailsObject);
         }
         Iterable<ListBlobItem> items =
                 client.listBlobs(cfg.getBlobPrefix(), cfg.isUseFlatListing(),
@@ -159,7 +165,7 @@ public class BlobServiceProducer extends DefaultProducer {
         if (object instanceof List) {
             blobBlocks = (List<BlobBlock>) object;
         } else if (object instanceof BlobBlock) {
-            blobBlocks = Collections.singletonList((BlobBlock)object);
+            blobBlocks = Collections.singletonList((BlobBlock) object);
         }
         if (blobBlocks == null || blobBlocks.isEmpty()) {
             throw new IllegalArgumentException("Illegal storageBlocks payload");
@@ -191,7 +197,7 @@ public class BlobServiceProducer extends DefaultProducer {
         if (object instanceof List) {
             blockEntries = (List<BlockEntry>) object;
         } else if (object instanceof BlockEntry) {
-            blockEntries = Collections.singletonList((BlockEntry)object);
+            blockEntries = Collections.singletonList((BlockEntry) object);
         }
         if (blockEntries == null || blockEntries.isEmpty()) {
             throw new IllegalArgumentException("Illegal commit block list payload");
@@ -385,7 +391,7 @@ public class BlobServiceProducer extends DefaultProducer {
             blobDataLength = range.getEndOffset() - range.getStartOffset();
         }
         if (blobDataLength == null) {
-            blobDataLength = (long)is.available();
+            blobDataLength = (long) is.available();
         }
         try {
             client.uploadPages(is, blobOffset, blobDataLength,
@@ -473,7 +479,7 @@ public class BlobServiceProducer extends DefaultProducer {
         if (body instanceof InputStream) {
             is = (InputStream) body;
         } else if (body instanceof File) {
-            is = new FileInputStream((File)body);
+            is = new FileInputStream((File) body);
         } else if (body instanceof byte[]) {
             is = new ByteArrayInputStream((byte[]) body);
         } else {
@@ -495,4 +501,13 @@ public class BlobServiceProducer extends DefaultProducer {
         }
     }
 
+
+    private void overrideBlobName(Exchange exchange) {
+        String blobName = exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, String.class);
+
+        if (StringUtils.isNotEmpty(blobName)) {
+            getEndpoint().getConfiguration().setBlobName(blobName);
+        }
+    }
+
 }
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java
index 49b9b38..730a670 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java
@@ -23,9 +23,7 @@ import java.io.FileInputStream;
 import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
-import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -41,11 +39,7 @@ public class BlobServiceAppendConsumerTest extends CamelTestSupport {
     @Test
     @Ignore
     public void testGetAppendBlob() throws Exception {
-        templateStart.send("direct:start", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody("Append Blob");
-            }
-        });
+        templateStart.send("direct:start", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody("Append Blob"));
         
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java
index fc203ee..578ee94 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java
@@ -23,9 +23,7 @@ import java.io.FileInputStream;
 import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
-import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -41,11 +39,7 @@ public class BlobServiceBlockConsumerTest extends CamelTestSupport {
     @Test
     @Ignore
     public void testGetBlockBlob() throws Exception {
-        templateStart.send("direct:start", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody("Block Blob");
-            }
-        });
+        templateStart.send("direct:start", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody("Block Blob"));
         
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationClientTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationClientTest.java
index 435458c..b2eb85b 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationClientTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationClientTest.java
@@ -24,8 +24,6 @@ import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
 import com.microsoft.azure.storage.blob.CloudBlockBlob;
 import com.microsoft.azure.storage.core.Base64;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -181,11 +179,8 @@ public class BlobServiceComponentConfigurationClientTest extends CamelTestSuppor
     }
     
     private static void createConsumer(Endpoint endpoint) throws Exception {
-        endpoint.createConsumer(new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                // noop
-            }
+        endpoint.createConsumer(exchange -> {
+            // noop
         });
     }
     
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java
index 2084fda..1185496 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java
@@ -25,8 +25,6 @@ import com.microsoft.azure.storage.blob.CloudBlob;
 import com.microsoft.azure.storage.blob.CloudBlockBlob;
 import com.microsoft.azure.storage.core.Base64;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -195,13 +193,10 @@ public class BlobServiceComponentConfigurationTest extends CamelTestSupport {
             (BlobServiceEndpoint)context.getEndpoint("azure-blob://camelazure/component1/blob/sub?credentials=#creds");
         assertEquals("blob/sub", endpoint.getConfiguration().getBlobName());
     }
-    
+
     private static void createConsumer(Endpoint endpoint) throws Exception {
-        endpoint.createConsumer(new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                // noop
-            }
+        endpoint.createConsumer(exchange -> {
+            // noop
         });
     }
     
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java
new file mode 100644
index 0000000..869c0b2
--- /dev/null
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerOverrideBlobNameTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.camel.component.azure.blob;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.DefaultExchange;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.camel.component.azure.blob.BlobHeadersConstants.OVERRIDE_BLOB_NAME;
+import static org.junit.Assert.assertEquals;
+
+public class BlobServiceProducerOverrideBlobNameTest {
+
+    private Exchange exchange;
+    private BlobServiceProducer producer;
+
+    @Before
+    public void setUp() {
+        CamelContext context = new DefaultCamelContext();
+        BlobServiceEndpoint endpoint = (BlobServiceEndpoint) context.getEndpoint("azure-blob://camelazure/container/blob?credentialsAccountKey=aKey&credentialsAccountName=name");
+        exchange = new DefaultExchange(context);
+        producer = new BlobServiceProducer(endpoint);
+    }
+
+    @Test
+    public void testOverrideBlobName() throws Exception {
+
+        String blobName = "blobName";
+        exchange.getIn().setHeader(OVERRIDE_BLOB_NAME, blobName);
+
+        producer.process(exchange);
+
+        assertEquals(blobName, producer.getEndpoint().getConfiguration().getBlobName());
+    }
+
+    @Test
+    public void testSetBlobNameFromEndpoint() throws Exception {
+
+        String blobName = "blob";
+        exchange.getIn().setHeader(OVERRIDE_BLOB_NAME, blobName);
+
+        producer.process(exchange);
+
+        assertEquals(blobName, producer.getEndpoint().getConfiguration().getBlobName());
+    }
+
+}
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java
index 058c0f8..6922a0a 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java
@@ -24,7 +24,6 @@ import java.util.Arrays;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
@@ -45,11 +44,7 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport {
     public void testUpdateBlockBlob() throws Exception {
         result.expectedMessageCount(1);
         
-        template.send("direct:updateBlockBlob", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody("Block Blob");
-            }
-        });
+        template.send("direct:updateBlockBlob", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody("Block Blob"));
         
         assertMockEndpointsSatisfied();
         
@@ -61,11 +56,7 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport {
     public void testUploadBlobBlocks() throws Exception {
         result.expectedMessageCount(1);
         final BlobBlock st = new BlobBlock(new ByteArrayInputStream("Block Blob List".getBytes()));
-        template.send("direct:uploadBlobBlocks", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody(st);
-            }
-        });
+        template.send("direct:uploadBlobBlocks", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody(st));
         
         assertMockEndpointsSatisfied();
         
@@ -77,11 +68,7 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport {
     public void testGetBlockBlob() throws Exception {
         result.expectedMessageCount(1);
         OutputStream os = new ByteArrayOutputStream();
-        template.send("direct:getBlockBlob", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody(os);
-            }
-        });
+        template.send("direct:getBlockBlob", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody(os));
         
         assertMockEndpointsSatisfied();
         
@@ -93,11 +80,7 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport {
     public void testUpdateAppendBlob() throws Exception {
         result.expectedMessageCount(1);
         
-        template.send("direct:updateAppendBlob", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody("Append Blob");
-            }
-        });
+        template.send("direct:updateAppendBlob", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody("Append Blob"));
         
         assertMockEndpointsSatisfied();
         
@@ -110,11 +93,7 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport {
         result.expectedMessageCount(1);
         final byte[] data = new byte[512];
         Arrays.fill(data, (byte)1);
-        template.send("direct:updatePageBlob", ExchangePattern.InOnly, new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setBody(new ByteArrayInputStream(data));
-            }
-        });
+        template.send("direct:updatePageBlob", ExchangePattern.InOnly, exchange -> exchange.getIn().setBody(new ByteArrayInputStream(data)));
         
         assertMockEndpointsSatisfied();
         
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureServiceCommonTestUtil.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureServiceCommonTestUtil.java
index ab860a9..04dbe33 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureServiceCommonTestUtil.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/AzureServiceCommonTestUtil.java
@@ -66,8 +66,7 @@ public final class AzureServiceCommonTestUtil {
 
     public static CloudBlockBlob createBlockBlobClient(String accountName, String accountKey) throws Exception {
         URI uri = new URI("https://camelazure.blob.core.windows.net/container1/blobBlock");
-        CloudBlockBlob client = new CloudBlockBlob(uri, newAccountKeyCredentials(accountName, accountKey));
-        return client;
+        return new CloudBlockBlob(uri, newAccountKeyCredentials(accountName, accountKey));
     }
 
     public static CloudBlockBlob createBlockBlobClient() throws Exception {
@@ -86,8 +85,7 @@ public final class AzureServiceCommonTestUtil {
 
     public static CloudQueue createQueueClient(String accountName, String accountKey) throws Exception {
         URI uri = new URI("https://camelazure.queue.core.windows.net/testqueue/");
-        CloudQueue client = new CloudQueue(uri, newAccountKeyCredentials(accountName, accountKey));
-        return client;
+        return new CloudQueue(uri, newAccountKeyCredentials(accountName, accountKey));
     }
 
     public static CloudQueue createQueueClient() throws Exception {
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/MissingCredentialsTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/MissingCredentialsTest.java
index 3ba16ae..42151bf 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/MissingCredentialsTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/common/MissingCredentialsTest.java
@@ -27,7 +27,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.apache.camel.component.azure.blob.BlobServiceComponent.MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE;
+import static org.apache.camel.component.azure.blob.BlobServiceComponent.MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE;
 import static org.apache.camel.component.azure.common.AzureServiceCommonTestUtil.ACCOUNT_NAME;
 import static org.apache.camel.component.azure.common.AzureServiceCommonTestUtil.BLOB_NAME;
 import static org.apache.camel.component.azure.common.AzureServiceCommonTestUtil.CONTAINER_NAME;
@@ -93,7 +93,7 @@ public class MissingCredentialsTest extends CamelTestSupport {
     // Missing Credentials Blob Tests
     @Test
     public void createBlobEndpointWithoutCredentials() {
-        createEndpointWithoutCredentials(missingCredentialsBlobUriEndoint, MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+        createEndpointWithoutCredentials(missingCredentialsBlobUriEndoint, MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
     }
 
     @Test
@@ -105,12 +105,12 @@ public class MissingCredentialsTest extends CamelTestSupport {
 
     @Test
     public void createBlobEndpointWithoutCredentialsAccountName() {
-        createEndpointWithoutCredentials(missingCredentialsAccountNameBlobUriEndoint, MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+        createEndpointWithoutCredentials(missingCredentialsAccountNameBlobUriEndoint, MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
     }
 
     @Test
     public void createBlobEndpointWithoutCredentialsAccountKey() {
-        createEndpointWithoutCredentials(missingCredentialsAccountKeyBlobUriEndoint, MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+        createEndpointWithoutCredentials(missingCredentialsAccountKeyBlobUriEndoint, MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
     }
 
     // Missing Credentials Queue Tests
@@ -147,7 +147,7 @@ public class MissingCredentialsTest extends CamelTestSupport {
     @Test
     public void testBlobClientWithoutAnonymousCredentials() throws Exception {
         exceptionRule.expect(ResolveEndpointFailedException.class);
-        exceptionRule.expectMessage(MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+        exceptionRule.expectMessage(MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
         CloudBlockBlob client =
                 new CloudBlockBlob(URI.create("https://camelazure.blob.core.windows.net/container/blob"),
                         StorageCredentialsAnonymous.ANONYMOUS);
@@ -158,7 +158,7 @@ public class MissingCredentialsTest extends CamelTestSupport {
     @Test
     public void testBlobClientWithoutCredentials() throws Exception {
         exceptionRule.expect(ResolveEndpointFailedException.class);
-        exceptionRule.expectMessage(MISSING_BLOB_CREDNTIALS_EXCEPTION_MESSAGE);
+        exceptionRule.expectMessage(MISSING_BLOB_CREDENTIALS_EXCEPTION_MESSAGE);
         CloudBlockBlob client =
                 new CloudBlockBlob(URI.create("https://camelazure.blob.core.windows.net/container/blob"));
         context.getRegistry().bind("azureBlobClient", client);
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentClientConfigurationTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentClientConfigurationTest.java
index 8ef0fdc..52022e3 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentClientConfigurationTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentClientConfigurationTest.java
@@ -23,8 +23,6 @@ import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
 import com.microsoft.azure.storage.core.Base64;
 import com.microsoft.azure.storage.queue.CloudQueue;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -129,11 +127,8 @@ public class QueueServiceComponentClientConfigurationTest extends CamelTestSuppo
     
     
     private static void createConsumer(Endpoint endpoint) throws Exception {
-        endpoint.createConsumer(new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                // noop
-            }
+        endpoint.createConsumer(exchange -> {
+            // noop
         });
     }
     
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentConfigurationTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentConfigurationTest.java
index 8176972..3c9afdd 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentConfigurationTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceComponentConfigurationTest.java
@@ -23,8 +23,6 @@ import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
 import com.microsoft.azure.storage.core.Base64;
 import com.microsoft.azure.storage.queue.CloudQueue;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -129,11 +127,8 @@ public class QueueServiceComponentConfigurationTest extends CamelTestSupport {
     
     
     private static void createConsumer(Endpoint endpoint) throws Exception {
-        endpoint.createConsumer(new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                // noop
-            }
+        endpoint.createConsumer(exchange -> {
+            // noop
         });
     }