0
votes

Here is my code to fetch all the jpg files from the 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=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'.
1
2 things: 1) I believe you have shared your storage account keys. Though I have edited the question and removed them, but please change the keys ASAP. Anyone can get access to your account using those credentials. 2) Please edit your question and include the result you're expecting and the result you're actually getting. Simply saying "it is not working" unfortunately is not enough to identify what exactly is wrong.Gaurav Mantri
@GauravMantri I had already edited the storage account keys, those weren't my actual keys. Yeah I'll edit it.Rakshita Kv
Logs say "No job functions found." How do you deploy your function app? using docs.microsoft.com/en-us/azure/azure-functions/… ?Alexey Rodionov
@AlexeyRodionov Yes by making a build out of it using mavenRakshita Kv

1 Answers

1
votes

Please set "FUNCTIONS_WORKER_RUNTIME" to "java" not java8