0

Every id I receive from queue has the value "00000000-0000-0000-0000-000000000000" rather than for example:

random_id

Here is my code:

[FunctionName("FunctionName")]
[Singleton("{Path}", SingletonScope.Function, Mode = SingletonMode.Listener)]
public async Task Run(
        [QueueTrigger("externalQueue", Connection = ConfigurationConstants.ConnectionString)]
        BaseQueueRequest req,
        ILogger logger,
        string id)
{
    // ...
}

I created this topic because solution from here does not work for me.

For service bus trigger it worked fine, but when I switched to QueueTrigger and changed messageId to Id, but I always receive a bad id.

My question is how can I receive real ID from the message?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Julia
  • 15
  • 3

1 Answers1

0

After reproducing from end, this is working fine for me when I configure connection string as below in my local.settings.json.

When connecting to cloud storage:

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "constre",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "constre": "<CONNECTIONSTRING>"
  }
}

When connecting to local storage:

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet"
    }
}

Below is my function.json

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace FunctionApp9
{
    public class Function3
    {
        [FunctionName("Function3")]
        public void Run([QueueTrigger("myqueue-items", Connection = "constre")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
}

enter image description here

Alternatively, I have configured connection string using Connected services as below.

enter image description here

enter image description here

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18