[BUG] MessageToPocoConverter overrides any custom ServiceBusReceivedMessage open converters
See original GitHub issueLibrary name and version
Microsoft.Azure.WebJobs.Extensions.ServiceBus 5.7.0
Describe the bug
Hey,
As in title, I’m trying to add my custom open converter for ServiceBusReceivedMessage
:
...
context.AddOpenConverter<ServiceBusReceivedMessage, MessageEnvelope<OpenType>>(typeof(GenericMessageEnvelopeConverter<>));
...
also tried with OpenType.Poco
...
context.AddOpenConverter<ServiceBusReceivedMessage, MessageEnvelope<OpenType.Poco>>(typeof(GenericMessageEnvelopeConverter<>));
...
Here is my open converter:
internal class GenericMessageEnvelopeConverter<T> : IConverter<ServiceBusReceivedMessage, MessageEnvelope<T>>
Expected behavior
My custom open converter is called instead of MessageToPocoConverter
.
Actual behavior
Every time when queue triggers:
[FunctionName(nameof(ServiceBusStart))]
public async Task ServiceBusStart(
[ServiceBusTrigger("%queueName%", Connection = "SbConnString")] MessageEnvelope<MyCustomType> msg,
[DurableClient] IDurableOrchestrationClient starter)
it calls MessageToPocoConverter
- which is added in ServiceBusExtensionProvider - well I am not 100% it calls MessageToPocoConverter
, but I get this error when using MessageEnvelope
without parameterless constructor .
I believe that I’ve wired up everything correctly since when I change my custom converter from open to regular one:
...
context.AddConverter<ServiceBusReceivedMessage, int>(new GenericMessageEnvelopeConverter());
...
the converter is called as expected
Reproduction Steps
Create custom ServiceBusReceivedMessage
open converter and trigger it with message.
Environment
local machine Windows 10, netcoreapp3.1, VS 2022
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Issue moved to Azure/azure-webjobs-sdk #2925 via Zenhub
Thank you for your feedback. Tagging and routing to the team member best able to assist.