dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

Same application doesn't allow to process CloudEvent and raw messages

Open fabistb opened this issue 9 months ago • 6 comments

Expected Behavior

The same application should be able using the [Topic] attribute to subscribe to CloudEvent and Raw messages. The background is that this would easily allow to migrate from the Servicebus Queue binding to the Servicebus Queue Pub/Sub component and also make it more flexible dealing with messages from non Dapr system.

There is also a unexpected behavior with the optional enableRawPayload property from the [Topic] attribute if the CloudEvent middleware has been removed.

On a different note I also haven't found a point in the docs that it isn't possible to process CloudEvents and Raw message with the same application.

Actual Behavior

It isn't possible to process Raw messages and CloudEvent messages with the same application since the behavior heavily depends on the Dapr CloudEvent middleware.

CloudEvent middleware enabled

  • CloudEvent message send - enableRawPayload not set --> 200 OK --> expected
  • Raw message send - enableRawPayload true --> 415 Unsupported Media Type --> unexpected
  • Raw message send - enableRawPayload false --> 415 Unsupported Media Type --> expected?

CloudEvent middleware disabled

  • CloudEvent message send - enableRawPayload not set --> 400 Bad Request --> expected
  • Raw message send - enableRawPayload true --> 400 Bad Request --> unexpected?
  • Raw message send _enableRawPayload false --> 200 OK --> unexpected?

Steps to Reproduce the Problem

Simple Asp.Net Core test application to show the different behaviors. https://github.com/fabistb/dotnet-dapr-pub-sub-raw

Note

This issue has already been mentioned in the past:

  • #1088
  • #989

Release Note

RELEASE NOTE: FIX Allow to process CloudEvent and Raw messages via Pub/Sub in the same application.

fabistb avatar May 22 '24 20:05 fabistb