Local deployment of Azure Service Bus Queue Trigger getting message as null
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the ServiceBusQueueTrigger annotation and the ServiceBusQueueHandler.execute method shown in the issue, then reproduce the local deployment using the listed Azure Functions and Spring Boot setup. Trace why the String message is null even though the trigger executes; done means the handler receives and logs the published queue message locally.
Written by the indexing model from the issue text.
Description
When I deploy an Azure Function locally using Spring Boot and spring-cloud-function-adapter-azure library. I was able to build, package and deploy the Function Application locally.
I have installed:
- Azure CLI version 2.16
- Azure Function CLI (func) version 3.0.31
- .NET SDK 3.1.404
- Also installed Azurite V3 Visual Studio Code extension for local blob storage connection string
I have executed func settings add AzureWebJobsStorage "useDevelopmentStorage=$true" to utilize local blob storage, AzureServiceBusConnection connecction string as "Endpoint-sb://my-service-bus-server.servicebus.windows.net/;SharedAccessKeyName=Root;SharedAccessKey=xyz;, FUNCTIONS_EXTENSION_VERSION as 2, FUNCTIONS_WORKER_RUNTIME as java, MAIN_CLASS as Spring Boot Application Main Classname.
The Function Application starts properly I have deployed 2 functions (1) HttpTrigger and (2) ServiceBusQueueTrigger. HttpTrigger works properly but when I publish a message to the Queue to which I have configured ServiceBusQueueTrigger the trigger gets executed properly but the message is always null. This is the stack-trace as given below:
[2021-01-08T08:04:33.326Z] 2021-01-08 13:34:33.308 INFO 4764 --- [pool-2-thread-3] AbstractSpringFunctionAdapterInitializer : Initializing: class com.bestminds.azurefunction.AzureServiceBusSampleAzureFunction
[2021-01-08T08:04:33.328Z] Handler processing a request for: orders
[2021-01-08T08:04:33.351Z] =========||==============|/=///_/
[2021-01-08T08:04:33.352Z] :: Spring Boot :: (v2.2.9.RELEASE)
[2021-01-08T08:04:33.354Z] 2021-01-08 13:34:33.340 INFO 4764 --- [pool-2-thread-3] o.s.boot.SpringApplication : Starting application on XYZIND115914 with PID 4764 (C:\spring-boot-azure-function-showcase\target\azure-functions\bestminds\azure-functions-0.0.1-SNAPSHOT.jar started by JohnDoe in C:\spring-boot-azure-function-showcase\target\azure-functions\AzureServiceBusSampleAzureFunction)
[2021-01-08T08:04:33.360Z] 2021-01-08 13:34:33.340 INFO 4764 --- [pool-2-thread-3] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
[2021-01-08T08:04:33.697Z] 2021-01-08 13:34:33.689 INFO 4764 --- [pool-2-thread-3] o.s.boot.SpringApplication : Started application in 0.369 seconds (JVM running for 287.696)
[2021-01-08T08:14:58.013Z] Executing 'Functions.orders' (Reason='(null)', Id=0ad0ec7c-917c-4d07-9700-5ff5376a89f4)
[2021-01-08T08:14:58.015Z] Trigger Details: MessageId: ID:7aada22d-6fd4-4a8b-b802-65738b39ef6f:1:1:1-1, SequenceNumber: 2, DeliveryCount: 1, EnqueuedTimeUtc: 2021-01-08T08:14:57.7860000Z, LockedUntilUtc: 2021-01-08T08:15:27.9730000Z, SessionId: (null)
[2021-01-08T08:14:58.027Z] 2021-01-08 13:44:58.022 INFO 4764 --- [pool-2-thread-4] o.s.c.function.utils.FunctionClassUtils : Main class: class com.bestminds.azurefunction.AzureServiceBusSampleAzureFunction
[2021-01-08T08:14:58.029Z] Message is received: null
[2021-01-08T08:14:58.032Z] Handler processing a request for: orders
[2021-01-08T08:14:58.034Z] Function "orders" (Id: 0ad0ec7c-917c-4d07-9700-5ff5376a89f4) invoked by Java Worker
[2021-01-08T08:14:58.036Z] Executed 'Functions.orders' (Succeeded, Id=0ad0ec7c-917c-4d07-9700-5ff5376a89f4, Duration=25ms)
See line #18 which logs the JMS message as received by Function and it show null all the time. The actual Java Class is as given below
public class ServiceBusQueueHandler extends AzureSpringBootRequestHandler<String, Void> {
@FunctionName("orders")
public Void execute(@ServiceBusQueueTrigger(name = "orders", queueName = "eas_queue",
connection = "AzureServiceBusConnection")
final String message, final ExecutionContext context) {
context.getLogger().info("Message is received: " + message);
return handleRequest(message, context);
}
}
Do we have a solution to execute Service Bus Queue Triggers locally ?
- Dominant language
- Java
- Stars
- 45
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-functions-java-library
-
area:java-functions
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/azure-functions-java-library#229 · 1 comment ·
-
area:java-functions
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Azure/azure-functions-java-library#222 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
area:java-functions
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
area:java-functions
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in Azure/azure-functions-java-library
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1152 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo-graphs#75 ·