Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
protected static Task SubscribeAsync<TMessage, TMessageContext>(Func<TMessage, TMessageContext, Task> asyncHandler)
{
return BusClient.SubscribeAsync<TMessage, TMessageContext>(async (message, context) =>
{
var customCtx = context as CustomContext;
using (LogContext.PushProperty("executionId", customCtx?.ExecutionId))
using (LogContext.PushProperty("origin", customCtx?.Origin))
using (LogContext.PushProperty("sessionId", customCtx?.SessionId))
{
await asyncHandler(message, context);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment