-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I have the following Java function:
package com.microsoft.azure.samples;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobClient;
import java.util.logging.Logger;
/**
* Azure Functions with Event Grid Blob Trigger using SDK type bindings.
*/
public class ProcessBlobUpload {
/**
* This function is triggered by Event Grid when a blob is created in the unprocessed-pdf container.
* It processes the blob and copies it to the processed-pdf container using SDK type bindings.
*/
@FunctionName("processBlobUpload")
@StorageAccount("PDFProcessorSTORAGE")
public void processBlobUpload(
@BlobTrigger(
name = "inputBlob",
path = "unprocessed-pdf/{name}",
source = "EventGrid"
) BlobClient inputBlob,
@BindingName("name") String blobName,
@BlobInput(
name = "outputBlobContainerClient",
path = "processed-pdf"
) BlobContainerClient outputBlobContainerClient,
final ExecutionContext context) {
Logger logger = context.getLogger();
logger.info(String.format("Java Blob Trigger (using Event Grid) processed blob\n Name: %s \n", blobName));
try {
String processedBlobName = "processed_" + blobName;
BlobClient outputBlob = outputBlobContainerClient.getBlobClient(processedBlobName);
// Get blob client for the processed blob
outputBlob.upload(inputBlob.openInputStream(), true);
logger.info(String.format("PDF processing complete for %s", processedBlobName));
} catch (Exception error) {
logger.severe(String.format("Error processing blob %s: %s", blobName, error.getMessage()));
throw new RuntimeException(error);
}
}
}
When testing locally with Azurite, the input binding even though path is set to processed-pdf
will instead use the trigger container unprocessed-pdf
which is incorrect. Debugging locally the inspector shows this and the processed_<name>
file is incorrectly created in the wrong folder.

Metadata
Metadata
Assignees
Labels
No labels