Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Service Bus OutputBinding doesn't support ServiceBusMessage type with Metadata

Open
#570 2 comments 6 reactions 1 assignee View on GitHub

@shreyas-gopalakrishna is already working on this.

Since Feb 24, 2023.

Assessment

This issue has not been assessed yet.

Description

area:java-functions Bug needs-investigation Needs: Triage (Functions)

There doesn't appear to be equivalent functionality for setting ServiceBusMessage Metadata in the Java worker. Compare with the C# documentation: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-output?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#usage

Use the ServiceBusMessage type when sending messages with metadata. Parameters are defined as return type attributes. Use an ICollector or IAsyncCollector to write multiple messages. A message is created when you call the Add method.

Is there no equivalent in Java?

Repro steps

Provide the steps required to reproduce the problem:

  1. Create an Azure Function.
  2. Add azure-messaging-servicebus dependency to project.
  3. Add a @ServiceBusTopicOutput binding of type OutputBinding<ServiceBusMessage>.
  4. Create a ServiceBusMessage msg = new ServiceBusMessage("message body") object.
  5. Set some metadata via sbMessage.getApplicationProperties().put("foo","bar").
  6. call .setValue(msg) on the output binding.
  7. Run the function.
Expected behavior

A message is added to the Service Bus topic with a body of "message body" and custom metadata of "foo": "bar".

Actual behavior

The resulting message body on the topic is a ServiceBusMessage serialized as a POJO object. Custom metadata is missing.

Known workarounds

Use a ServiceBusSenderClient instead of output bindings.

Related information
Dominant language
Java
Stars
103
Forks
74
Avg merge
1d 11h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/azure-functions-java-worker

All issues in Azure/azure-functions-java-worker

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.