Функция приложения Azure в Java для просмотра списка BLOB-файлов из учетной записи хранения Azure. - PullRequest
0 голосов
/ 10 сентября 2018

Вот мой код для извлечения всех файлов JPG из BLOB-объекта:

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 = счет-имя, AccountKey = счет-ключа; 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'.

1 Ответ

0 голосов
/ 11 сентября 2018

Пожалуйста, установите для "FUNCTIONS_WORKER_RUNTIME" значение "java", а не java8

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...