Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

653
Visualizações
How to set camel case using IAsyncCollector with System.Text.Json in Azure Functions?

I'm migrating Azure Functions v3 from Newtonsoft.Json to System.Text.Json and trying to get camelCase working globally.

For these:

  • SignalR
  • Service Bus output bindings
  • Cosmos DB

I was able to explicitly pass JsonSerializerOptions or set it globally (SignalR) but I'm not able to do so for IAsyncCollector.

Here is my code:

[FunctionName(nameof(SampleFunction))]
public async Task Run(
    [ServiceBusTrigger(ServiceBusQueue.QueueA)] string json,
    [ServiceBus(ServiceBusQueue.QueueB)] IAsyncCollector<Delivery> queueB,
    [ServiceBus(ServiceBusQueue.QueueC)] IAsyncCollector<Driver> queueC,
    ExecutionContext context)
{
        // ... do some work

        await queueB.AddAsync(objectB).ConfigureAwait(false);

        // ... do some more work

        await queueC.AddAsync(objectC).ConfigureAwait(false);
}

objectB and objectC ends up in service bus not with camel case. As a workaround I'm setting property names as case insensitive on the receiving function.

PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true

Any idea how can I get IAsyncCollector to serialize with camel case?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I recommend not using IAsyncCollector at all. The providers for IAsyncCollector don't have many knobs for configuration:

  • Serialization
  • Batching
  • Retries
  • Error handling

What's more, some implementations have changed these implementation details between releases without warning. For these reasons, I recommend never using IAsyncCollector and just using the APIs directly, where you have full control over all of these aspects. IAsyncCollector is a nice abstraction, but it's precisely that abstract nature that makes it unsuitable in the end.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda