Ejemplo n.º 1
0
        public void Publish <T>(T message, Action <IPublishContext <T> > contextCallback)
            where T : class
        {
            PublishedMessage <T> published = null;

            try
            {
                _bus.Publish(message, context =>
                {
                    published = new PublishedMessage <T>(context);

                    contextCallback(context);
                });
            }
            catch (Exception ex)
            {
                if (published != null)
                {
                    published.SetException(ex);
                }
                throw;
            }
            finally
            {
                if (published != null)
                {
                    _published.Add(published);
                    _scenario.AddPublished(published);
                }
            }
        }
Ejemplo n.º 2
0
        Task IPublishObserver.PostPublish <T>(PublishContext <T> context)
        {
            _messages.Add(context);

            return(TaskUtil.Completed);
        }
Ejemplo n.º 3
0
 public void AddPublished(IPublishedMessage message)
 {
     _published.Add(message);
 }