0

I have the following function:

[FunctionName("Function1")]
public static HttpResponseMessage Run(
    [HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequestMessage req,             
    TraceWriter log,
    [Queue("myqueuename")] ICollector<string> queue)
{
    . . .
    queue.Add(msg);

When I invoke this, I get no error, and the function appears to run correctly (I'm running it locally from VS atm). However, the queue in question doesn't get added to.

Looking around the web, I've seen at least one example that suggests using the BrokeredMessage class might work. I've tried using BrokeredMessage:

BrokeredMessage bm = new BrokeredMessage(new test() {test1 = msg});
queue.Add(bm);

This gives an error saying it can't read DeliveryCount.

This leaves me with two questions: firstly, should this work using ICollector<string> (and if so, what have I done wrong)? The second question relates to BrokeredMessage - it seems to exist in a Nuget package called ServiceBusv1_1 which has a description that makes me think it is not intended for this purpose: is that the correct package?

1
  • Did you try adding the queue as an outputbinding? Commented Jan 4, 2018 at 9:21

1 Answer 1

1

Queue attribute means Azure Storage Queue, not Service Bus. Use ServiceBus attribute instead.

With that, both string and BrokeredMessage outputs should work fine.

You can walk through examples in docs.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - for anyone else looking for the same thing - the Nuget package is nuget.org/packages/Microsoft.Azure.WebJobs.ServiceBus. However, for the release version, there is a dependency on a beta release of nuget.org/packages/Microsoft.Azure.WebJobs/3.0.0-beta4 for some reason

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.