Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!