Fixed NRE with async methods returning a message
This commit is contained in:
parent
c644b0d2b4
commit
f6c4ccdadc
@ -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)
|
private static Task Reply(object message, IMessageContext messageContext)
|
||||||
{
|
{
|
||||||
var publisher = (IInternalPublisher)messageContext.DependencyResolver.Resolve<IPublisher>();
|
var publisher = (IInternalPublisher)messageContext.DependencyResolver.Resolve<IPublisher>();
|
||||||
|
@ -120,9 +120,10 @@ namespace Test
|
|||||||
* This will automatically include the correlationId in the response and
|
* This will automatically include the correlationId in the response and
|
||||||
* use the replyTo header of the request if provided.
|
* 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)");
|
Console.WriteLine(">> PoloConfirmation (returning confirmation)");
|
||||||
|
await Task.Delay(100);
|
||||||
|
|
||||||
return new PoloConfirmationResponseMessage
|
return new PoloConfirmationResponseMessage
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user