private IAmAMessageProducer GetMessageProducerFromConfig(IMessageProducerFactoryProvider messageProducerFactoryProvider) { var messageProducerFactory = messageProducerFactoryProvider.Get(); if (messageProducerFactory == null) { throw new Exception("Mis-configured viewer - no message producer found"); } IAmAMessageProducer messageProducer = null; Exception foundException = null; try { messageProducer = messageProducerFactory.Create(); } catch (Exception e) { foundException = e; } if (messageProducer == null) { string message = "Mis-configured viewer - cannot create found message producer"; if (foundException != null) { message += ". " + foundException.Message; } throw new Exception(message); } return(messageProducer); }
public RepostCommandHandler(IMessageStoreViewerFactory messageStoreViewerFactory, IMessageProducerFactoryProvider messageProducerFactoryProvider, IAmAMessageRecoverer messageRecoverer) { _messageStoreViewerFactory = messageStoreViewerFactory; _messageProducerFactoryProvider = messageProducerFactoryProvider; _messageRecoverer = messageRecoverer; }