Azure / Azure/azure-functions-java-worker

Service Bus OutputBinding doesn't support ServiceBusMessage type with Metadata

Đang mở
#570 2 bình luận 6 reaction 1 người được giao Xem trên GitHub

@shreyas-gopalakrishna đang làm issue này rồi.

Từ ngày 24/2/2023.

area:java-functions Bug needs-investigation Needs: Triage (Functions)
Ngôn ngữ chính
Java
Star
103
Fork
74
Merge trung bình
4 ngày 8 giờ
Pull request đã merge (30 ngày)
2

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.