1
0
mirror of synced 2024-11-21 17:03:50 +00:00

Fixed NRE with async methods returning a message

This commit is contained in:
Mark van Renswoude 2018-12-21 10:49:30 +01:00
parent c5f2c4ba89
commit 91ce1555d5
2 changed files with 12 additions and 1 deletions

View File

@ -38,6 +38,16 @@ namespace Tapeti.Default
}
// ReSharper disable once UnusedMember.Local - used implicitly above
private static async Task PublishGenericTaskResult<T>(IMessageContext messageContext, object value) where T : class
{
var message = await (Task<T>)value;
if (message != null)
await Reply(message, messageContext);
}
private static Task Reply(object message, IMessageContext messageContext)
{
var publisher = (IInternalPublisher)messageContext.DependencyResolver.Resolve<IPublisher>();

View File

@ -120,9 +120,10 @@ namespace Test
* This will automatically include the correlationId in the response and
* use the replyTo header of the request if provided.
*/
public PoloConfirmationResponseMessage PoloConfirmation(PoloConfirmationRequestMessage message)
public async Task<PoloConfirmationResponseMessage> PoloConfirmation(PoloConfirmationRequestMessage message)
{
Console.WriteLine(">> PoloConfirmation (returning confirmation)");
await Task.Delay(100);
return new PoloConfirmationResponseMessage
{