[英]Not able to uploading csv file to azure storage blob
下面的代碼沒有將示例 MY_TEST_FILE.csv 上傳到 azure 存儲 blob。 無法解決問題或找不到任何這樣做的例子。 代碼中缺少什么? 日志中沒有錯誤 & 在 azure 存儲中找不到文件
'''
StorageSharedKeyCredential credential = new StorageSharedKeyCredential("test", "test");
String uri = "https://test.blob.core.windows.net";
BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint(uri)
.credential(credential)
.buildClient();
CamelContext mycontext = new DefaultCamelContext();
mycontext.getRegistry().bind("client", client);
mycontext.setStreamCaching(true);
mycontext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("file:c://folder2?fileName=MY_TEST_FILE.csv&noop=true").to("azure-storage-blob://test/report?blobName=MY_TEST_FILE.csv&operation=uploadBlockBlob&serviceClient=#client");
}
});
mycontext.start();'''
您可能需要為 azure-storage-blob 組件提供憑據。
StorageSharedKeyCredential credentials = new StorageSharedKeyCredential(accountName, accountKey);
mycontext.getRegistry().bind("credentials", credentials);
from("file:c://folder2?fileName=MY_TEST_FILE.csv&noop=true")
.to("azure-storage-blob:accountName/containerName?"
+ "blobName=MY_TEST_FILE.csv&operation=uploadBlockBlob"
+ "&credentials=#credentials");
請注意, #beanId
已被棄用,您可能必須根據駱駝版本切換到#bean:beanId
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.