How can we pass topic and subscription name from yaml in azure function - java

Sarupria Alpa 1 Reputation point
2021-02-12T11:13:54.62+00:00

I want to fetch subscriptionName value from deployment.yaml , config map settings. How can I get the value from there.

@FunctionName("TestHandler")
public void Handler(
@ServiceBusTopicTrigger(
name = "ServiceBus",
topicName = "topicname",
connection = "ServiceBusConnectionString",
subscriptionName = "subscriptionName")
String message,
final ExecutionContext context) {}

I tried passing value of subscriptionName as subscriptionName = "%MY_SUBSCRIPTION_CONFIG%" . But that doesn't take value from yaml

@Gaurav Mantri could you please suggest

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
572 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,516 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,606 Reputation points Microsoft Employee
    2021-02-15T13:00:34.76+00:00

    To read from app settings (or environment variables) using %<key>% should do the trick. In K8s, you would have to configure all key-value pairs in a ConfigMap as container environment variables for them to be picked up.

    0 comments No comments