我正在使用Capture事件将事件从Eventhub检索到存储容器。但是在捕获事件中,我选择Blob文件路径格式为
{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}
现在如何在博客触发器中提供动态Blob路径。
我写成如下
@FunctionName("AzureBlogTriggerFn5")
public void blobHandler(
@BlobTrigger(name = "content", path = "uts-blobcontainer-nb-dev/uts-eventhubns/uts-nb-eventhub/{partition}/{yyyy}/{MM}/{dd}/{HH}/{mm}/{ss}/{fileName}", dataType = "binary", connection = "AzureWebJobsStorage") byte[] content,
@BindingName("fileName") String fileName,
final ExecutionContext context
) throws StorageException, IOException, URISyntaxException, InvalidKeyException, InterruptedException {
context.getLogger().info("Java Blob trigger function processed a blob. Name: " + fileName + "\n Size: " + content.length + " Bytes");
我遇到以下错误
**2019-12-19T15:05:52.576 [Error] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.DecompressServiceFunctionNB'. System.Private.CoreLib: An item with the same key has already been added. Key: mm.**
请给我建议,如何为Azure中的Blogtrigger中的partitionId,年,月,日,小时,分钟,秒提供动态路径?
答案 0 :(得分:0)
我认为该错误是因为同时具有“ MM”和“ mm”。
使用trigger blob name patterns时,键可以是任何字符串。在您的情况下,类似的事情应该起作用
path = "uts-blobcontainer-nb-dev/uts-eventhubns/uts-nb-eventhub/{partitionId}/{year}/{month}/{day}/{hour}/{minute}/{second}/{fileName}"
And bind the ones you require in your function.