Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
驼峰Azure凭据作为选项而不是bean_Azure_Apache Camel - Fatal编程技术网

驼峰Azure凭据作为选项而不是bean

驼峰Azure凭据作为选项而不是bean,azure,apache-camel,Azure,Apache Camel,我想将凭据传递给Azure blob组件,而无需创建和注册bean 我有一个使用文件并将其路由到Azure Blob的路由 我希望这条路线是通用的 我面临的挑战是 我必须支持多个存储帐户 我们应该从钥匙库取证件。凭证可以随时更改,我无法控制。blob组件需要一个bean作为凭据。所以我剩下的唯一选择就是一粒豆子。因此,当我能够实现这一点时,我想知道camel是否应该能够接收凭据,而不是对象或客户端,而是作为选项的帐户名和密钥。Camel不支持keyVault,这有点让人扫兴。我可能可以帮助实现k

我想将凭据传递给Azure blob组件,而无需创建和注册bean

我有一个使用文件并将其路由到Azure Blob的路由

我希望这条路线是通用的

我面临的挑战是

我必须支持多个存储帐户 我们应该从钥匙库取证件。凭证可以随时更改,我无法控制。blob组件需要一个bean作为凭据。所以我剩下的唯一选择就是一粒豆子。因此,当我能够实现这一点时,我想知道camel是否应该能够接收凭据,而不是对象或客户端,而是作为选项的帐户名和密钥。Camel不支持keyVault,这有点让人扫兴。我可能可以帮助实现keyVault解决方案
这是我为实现我的目标而编写的bean

fromfile://somedir.tobean:azureService?sendFiletoAzurename,钥匙,容器

AzureService{

    public void sendFileToAzure(String storageAccountName,
            String storageAccountKey, String containerName, Exchange exchange) {
        StorageCredentials credentials = new StorageCredentialsAccountAndKey(
                storageAccountName, storageAccountKey);
        SimpleRegistry registry = new SimpleRegistry();
        GenericFile<?> file = (GenericFile<?>) exchange.getIn().getBody();
        String blobName = (String) exchange.getIn().getHeader("blobName");
        CamelContext context = new DefaultCamelContext(registry);
        registry.put("blobCredentials", credentials);
        String endpointUri = String.format(azureEndpointUri, storageAccountName,
                containerName, blobName);
        context.createProducerTemplate().sendBody(endpointUri, file);
    }
 }