示例#1
0
        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);
        }
示例#2
0
 public CacheMessage(IBusMessage contentMessage)
     : base(contentMessage?.GetType().Name)
 {
     Content     = contentMessage?.JsonSerialize();
     ContentType = contentMessage?.GetType().Name;
 }