Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
How to add user properties to Service Bus topic output from Javascript Azure Function

I'm working on a TypeScript Azure Function that has an Azure Service bus topic as its output. I can send messages with it without any problem, but I cannot set any metadata as custom property on the message.

I've tried using an object with the same interface as the ServiceBusMessage from the Service Bus Javascript SDK, like this:

import { AzureFunction, Context, HttpRequest } from "@azure/functions";

const httpTrigger: AzureFunction = async function (
  context: Context,
  req: HttpRequest
): Promise<void> {
  const message = {
    body: "my message content",
    applicationProperties: { key: "value" },
  };

  context.bindings.myTopic = message;
};

export default httpTrigger;

But the message is sent as-is, and the applicationProperties is not taken into account. I cannot see them on the Azure Portal in the Service Bus Explorer. The content of the message will be the JSON version of the message object.

I've tried with the extension bundles 3 and 4, without success.

I'm using this function.json file:

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": ["get", "post"]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "name": "myTopic",
      "type": "serviceBus",
      "queueName": "myTopic",
      "connection": "SERVICE_BUS_CONNECTION_STRING",
      "direction": "out"
    }
  ],
  "scriptFile": "../dist/servicebus-writer/index.js"
}

And this host.json file:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.3.0, 4.0.0)"
  }
}

How can I set those custom properties?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda