Azure / Azure/azure-functions-java-worker

Service Bus OutputBinding doesn't support ServiceBusMessage type with Metadata

Ouverte
#570 2 commentaires 6 réactions 1 personne assignée Réclamée par @shreyas-gopalakrishna Voir sur GitHub
area:java-functions Bug needs-investigation Needs: Triage (Functions)
Langage dominant
Java
Étoiles
103
Forks
74
Merge moyen
4 j 8 h
PR mergées (30 j)
2

Description

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](https://docs.microsoft.com/en-us/dotnet/api/azure.messaging.servicebus.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`.
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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.