I am running Visual Studio 2017 Preview and running the function code locally and I am using the out of the box Azure Function project template. I'm trying to have an Azure Function triggered by a timer send a message to a Service Bus queue using an output binding but it looks like the WebJob SDK can't bind the output to a string type.
Binding
"bindings": [
{
"type": "serviceBus",
"name": "msg",
"queueName": "myqueue",
"connection": "ServiceBusQueue",
"accessRights": "manage",
"direction": "out"
}
]
Timer Function
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace MyFunctionApp
{
public static class TimerTrigger
{
[FunctionName("TimerTriggerCSharp")]
public static void Run([TimerTrigger("1 * * * * *", RunOnStartup = true)]TimerInfo myTimer, TraceWriter log, out string msg)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
msg = "Hello!";
}
}
}
Error Message
TimerTriggerCSharp: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.TimerTriggerCSharp'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'msg' to type String&. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
Am I missing a step in the setup, or does the Service Bus binding really not support a string for an out
parameter