public static TResult GetResult <TResult>(this IBus <IBusMessage> bus, IBusMessage <TResult> message, TimeSpan?timeout = null) { var messageType = message.GetType(); var publishMethod = bus.GetType() .GetMethod("Publish", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance) .MakeGenericMethod(messageType); publishMethod.Invoke(bus, new object[] { message }); message.Wait(timeout); return(message.Result); }
public CacheMessage(IBusMessage contentMessage) : base(contentMessage?.GetType().Name) { Content = contentMessage?.JsonSerialize(); ContentType = contentMessage?.GetType().Name; }