Mark van Renswoude
165680fd38
- This is a breaking change for custom middleware implementations Added validation for return type handling - This may be breaking for incorrect implementations, but highly unlikely
33 lines
925 B
C#
33 lines
925 B
C#
using System.Threading.Tasks;
|
|
using Messaging.TapetiExample;
|
|
using Tapeti.Annotations;
|
|
|
|
namespace _03_FlowRequestResponse
|
|
{
|
|
[MessageController]
|
|
[DynamicQueue("tapeti.example.03")]
|
|
public class ReceivingMessageController
|
|
{
|
|
// No publisher required, responses can simply be returned
|
|
public static async Task<QuoteResponseMessage> HandleQuoteRequest(QuoteRequestMessage message)
|
|
{
|
|
var quote = message.Amount switch
|
|
{
|
|
1 =>
|
|
// Well, they asked for it... :-)
|
|
"'",
|
|
2 => "\"",
|
|
_ => new string('\'', message.Amount)
|
|
};
|
|
|
|
// Just gonna let them wait for a bit, to demonstrate async message handlers
|
|
await Task.Delay(1000);
|
|
|
|
return new QuoteResponseMessage
|
|
{
|
|
Quote = quote
|
|
};
|
|
}
|
|
}
|
|
}
|