question

SarupriaAlpa-7247 avatar image
0 Votes"
SarupriaAlpa-7247 asked PramodValavala-MSFT answered

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

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

@GauravMantri-7067 could you please suggest

azure-functionsazure-service-bus
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.