An Azure service that provides an event-driven serverless compute platform.
Hello Terence !
Thank you for posting on MS Learn Q&A.
Your func is being triggered in Azure and the evidence is:
Executing 'Functions.PaymentEventHandlerTrigger'
and the same service bus message is retried with increasing DeliveryCount so the real issue is that the invocation doesn't finish and eventually hits:
Timeout value of 00:30:00 exceeded
I think your code is hanging before your custom logs are written.
Message messageTest =
(Message) AzureFunctionUtil.enhanceInputIfNecessary(message, context);
For a normal Java Azure Function Service Bus trigger, you do not need this line since it can bind the message directly to a String.
So try to test first with the simplest possible handler:
@FunctionName("PaymentEventHandlerTrigger")
public void run(
@ServiceBusQueueTrigger(
name = "message",
queueName = "paymentqueue",
connection = "POC_SB_QUEUE_CONNECTION_KEY"
) String message,
final ExecutionContext context
) {
context.getLogger().info("Entered PaymentEventHandlerTrigger");
context.getLogger().info("Message body: " + message);
}
and add a log before and after the Spring adapter line if you still need it:
context.getLogger().info("Before enhanceInputIfNecessary");
Message messageTest =
(Message) AzureFunctionUtil.enhanceInputIfNecessary(message, context);
context.getLogger().info("After enhanceInputIfNecessary");
If you only see the first log so the Spring adapter call is blocking.
For Spring Cloud Function on Azure, you need to avoid mixing patterns. Either use a plain Azure Function handler with @ServiceBusQueueTrigger or follow the Spring Cloud Function adapter model properly.