79448458

Date: 2025-02-18 13:46:26
Score: 0.5
Natty:
Report link

Dynamically fix service topic and subscription name

FunctionController.java

@FunctionName("notificationEventTopicTrigger") public void serviceBusTopicEvent( @ServiceBusTopicTrigger(name = "message", topicName = "%TOPIC_NAME%", subscriptionName = "%SUBS_NAME%", connection = "SERVICE_CONN_URL") String message, final ExecutionContext context) { logInfo("Service bus trigger processed a message..."); eventProcessor.processEvent(message); }

local.settings.json

{ "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "java", "AzureWebJobsStorage": "UseDevelopmentStorage=true", "SUBS_NAME": "notification1", "SERVICE_CONN_URL": "Endpoint=sb://test", "TOPIC_NAME": "notification-topic", }, "Host": { "LocalHttpPort": 7072, "CORS": "*", "CORSCredentials": false } }

application.yml

spring: cloud: azure: servicebus: connection-string: ${SERVICE_CONN_URL} namespace: poc123 topic-name: ${TOPIC_NAME} subscription-name: ${SUBS_NAME}

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Prav_Singh