java - Java 中的 Azure 应用程序功能,用于查看来自 azure 存储帐户的 blob 文件列表
问题描述
这是我从 blob 中获取所有 jpg 文件的代码:
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
public class Function {
@FunctionName("blobprocessor")
@StorageAccount("AzureWebJobsStorage")
public void run(
@BlobTrigger(name = "content",
dataType = "binary",
path ="=imagescontainer/{name}.jpg") byte[] content,
@BindingName("myBlob") String name,
final ExecutionContext context
)
{
context.getLogger().info("Name: " + name + " Size: " + content.length + "
bytes");
}
}
local.settings.json` file
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage":
"DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core.windows.net", "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core .windows.net”,“FUNCTIONS_WORKER_RUNTIME”:“java8”,“FUNCTIONS_EXTENSION_VERSION”:“~2”}}
I am trying to list all the jpg files from a container using the above
code. I am trying to run this locally before deploying on it azure app
functions but it is not working. Please help me.
When I run "mvn azure-functions:run
[9/10/2018 9:19:53 AM] Initializing Host.
[9/10/2018 9:19:53 AM] Host initialization: ConsecutiveErrors=0,
StartupCount=1
[9/10/2018 9:19:53 AM] Starting JobHost
[9/10/2018 9:19:53 AM] Starting Host (HostId=rveeresh01-1999346529,
InstanceId=64beeb74-e930-46cc-b380-0a8fa316ccc7, Version=2.0.12050.0,
ProcessId=19228, AppDomainId=1, Debug=False,
FunctionsExtensionVersion=~2)
[9/10/2018 9:19:54 AM] Generating 0 job function(s)
[9/10/2018 9:19:54 AM] No job functions found. Try making your job
classes and methods public. If you're using binding extensions (e.g.
ServiceBus, Timers, etc.) make sure you've called the registration method
for the extension(s) in your startup code (e.g. config.UseServiceBus(),
config.UseTimers(), etc.).
[9/10/2018 9:19:54 AM] Host initialized (197ms)
[9/10/2018 9:19:54 AM] Host started (211ms)
[9/10/2018 9:19:54 AM] Job host started
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
[9/10/2018 9:20:01 AM] Host lock lease acquired by instance ID
'000000000000000000000000215C11A1'.
解决方案
请将“FUNCTIONS_WORKER_RUNTIME”设置为“java”而不是 java8
推荐阅读
- python - Django 模型降序/嵌套查询
- sql-server - MS PowerApps:如何使用复合主键“修补”SQL 表
- javascript - React.js 组件子元素到 DOM 元素
- rust - 为什么不能生锈macro_rules!拍后跟“<”?
- r - 如何在 R 中的小标题中添加一行?
- sql - 用于循环记录的 SQL 查询
- clojurescript - Clojurescript core.matrix aljabr 实现必须显式设置
- scala - Scala 中单例类型的 GADT 类型细化
- javascript - 使用多个指针作为解决方案的averagePair问题
- javascript - 在柱形图上显示 Datalabels(总数和 dataLabel 名称)-ReactJs highcharts