When using the method below, the PublishOptions that have been provided in the options argument are ignored. For example: custom message headers are not included in the event message.
PublishOptions that have been provided are also visible in the actual event message, for example custom message headers are included in the event message.
Actual behavior
All options are ignored
Versions
From what i can see all versions above NServiceBus v8 are effected.
Steps to reproduce
Create .NET 8 Isolated Azure function with NServiceBus 8+. Add and configure TestEvent type. Use code below from your function to emit an event.
public class TestPublishService(IFunctionEndpoint functionEndpoint) : ITestPublishService
{
public Task TestPublish(FunctionContext functionContext)
{
var options = new PublishOptions();
options.SetHeader("TestKey", "TestValue");
functionEndpoint.Publish(new TestEvent(), options, functionContext);
}
}
The message will be send, but the header "TestKey" is missing.
Relevant log output
No response
Additional Information
Workarounds
Use the message generator method.
Possible solutions
The problem is clearly visible below. The options argument is not handed over to the endpoint.Publish method, but is not used at all.
Describe the bug
Description
When using the method below, the PublishOptions that have been provided in the options argument are ignored. For example: custom message headers are not included in the event message.
Publish(object message, PublishOptions options, FunctionContext functionContext, CancellationToken cancellationToken = default)
https://github.com/Particular/NServiceBus.AzureFunctions.Worker.ServiceBus/blob/d4df9b9107dfd0bb80b6f006520746f781fed816/src/NServiceBus.AzureFunctions.Worker.ServiceBus/FunctionEndpoint.cs#L101
Expected behavior
PublishOptions that have been provided are also visible in the actual event message, for example custom message headers are included in the event message.
Actual behavior
All options are ignored
Versions
From what i can see all versions above NServiceBus v8 are effected.
Steps to reproduce
Create .NET 8 Isolated Azure function with NServiceBus 8+. Add and configure TestEvent type. Use code below from your function to emit an event.
The message will be send, but the header "TestKey" is missing.
Relevant log output
No response
Additional Information
Workarounds
Use the message generator method.
Possible solutions
The problem is clearly visible below. The options argument is not handed over to the endpoint.Publish method, but is not used at all.
https://github.com/Particular/NServiceBus.AzureFunctions.Worker.ServiceBus/blob/d4df9b9107dfd0bb80b6f006520746f781fed816/src/NServiceBus.AzureFunctions.Worker.ServiceBus/FunctionEndpoint.cs#L106
Additional information