Esempio 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);
                }
            }
        }
Esempio n. 2
0
        Task IPublishObserver.PostPublish <T>(PublishContext <T> context)
        {
            _messages.Add(context);

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