如何在功能内将消息推送到Azure服务总线上

如何在功能内将消息推送到Azure服务总线上

问题描述:

我需要用C#编写的Azure函数将消息推送到服务总线上.我在网上看到的示例显示了当出现新消息时如何触发azure函数.

I need my azure function written in C# to push a message onto the service bus. The examples I've seen online show how an azure function can be triggered when a new message happens.

有没有可用的示例?

当前的天蓝色函数(C#)

[FunctionName("IHandleMessage")]
        public void Run([ServiceBusTrigger("my.topic", "my.subscription", Connection = "mybus_SERVICEBUS")]string mySbMsg, ILogger log)
        {

            // send new message?

        }

非常感谢!J

更新

如何在azure函数中创建新消息

How to create a new message within an azure function

        public void Run([ServiceBusTrigger("my.topic", "my.subscription", Connection = "mybus_SERVICEBUS")]string mySbMsg, ILogger log)
        {            
            ServiceBusOutput("hello", log);  // Create a new message
        }

        [FunctionName("AnotherEvent")]
        [return: ServiceBus("my.other.queue", Connection = "mySERVICEBUS")]
        public static string ServiceBusOutput([HttpTrigger] dynamic input, ILogger log)
        {
            log.LogInformation($"C# function processed: {input.Text}");
            return input.Text;
        }