public RabbitMQEventDispatcher(RabbitMQOptions options, IEventHandlerTypeStore eventHandlerTypeStore, IHandlerFactory handlerFactory) : base(eventHandlerTypeStore, handlerFactory) { _options = options; _modelDict = new ConcurrentDictionary <string, IModel>(); var connectionFactory = new ConnectionFactory { HostName = _options.HostName, DispatchConsumersAsync = true }; if (_options.Port > 0) { connectionFactory.Port = _options.Port; } if (!string.IsNullOrWhiteSpace(_options.UserName)) { connectionFactory.UserName = _options.UserName; } if (!string.IsNullOrWhiteSpace(_options.Password)) { connectionFactory.Password = _options.Password; } _connection = connectionFactory.CreateConnection(); }
public RemoveCartLineHandler_Brasseler(ICartPipeline cartPipeline, IPricingPipeline PricingPipeline, IHandlerFactory HandlerFactory, IPromotionEngine promotionEngine) { this.cartPipeline = cartPipeline; this.pricingPipeline = PricingPipeline; this.HandlerFactory = HandlerFactory; this.PromotionEngine = promotionEngine; }
public IHandlerFactory GetServiceMethodHandlerFactory() { return(handlerFactory ?? (handlerFactory = overrides.ServiceMethodHandlerFactory != null ? overrides.ServiceMethodHandlerFactory(this) : new HandlerFactory(GetCodecContainer(), GetServiceMethodDelegateFactory()))); }
private static TestApiController CreateSubjectUnderTest( IHandlerFactory handlerFactory = null, IHandler <TestRequest> handler = null) { return(new TestApiController( GetHandlerFactory(handlerFactory, handler))); }
public FileWatcherService(IFolderMonitorFactory folderMonitorFactory, IHandlerFactory handlerFactory) { this.folderMonitorFactory = folderMonitorFactory; this.handlerFactory = handlerFactory; services = new Queue <FolderMonitor>(); InitializeComponent(); }
public ProjectionRepository(CronusContext context, IProjectionStore projectionStore, ISnapshotStore snapshotStore, ISnapshotStrategy snapshotStrategy, InMemoryProjectionVersionStore inMemoryVersionStore, IHandlerFactory handlerFactory, ProjectionHasher projectionHasher) { if (context is null) { throw new ArgumentException(nameof(context)); } if (projectionStore is null) { throw new ArgumentException(nameof(projectionStore)); } if (snapshotStore is null) { throw new ArgumentException(nameof(snapshotStore)); } if (snapshotStrategy is null) { throw new ArgumentException(nameof(snapshotStrategy)); } if (inMemoryVersionStore is null) { throw new ArgumentException(nameof(inMemoryVersionStore)); } this.context = context; this.projectionStore = projectionStore; this.snapshotStore = snapshotStore; this.snapshotStrategy = snapshotStrategy; this.inMemoryVersionStore = inMemoryVersionStore; this.handlerFactory = handlerFactory; this.projectionHasher = projectionHasher; }
public HttpServer( IStreamListener streamListener, string[] hosts, IHandlerFactory handlerFactory) { if (streamListener == null) { throw new ArgumentNullException(nameof(streamListener)); } if (hosts == null) { throw new ArgumentNullException(nameof(hosts)); } if (!hosts.Any()) { throw new ArgumentException("At least one host is needed", nameof(hosts)); } if (handlerFactory == null) { throw new ArgumentNullException(nameof(handlerFactory)); } _lock = new object(); _streamListener = streamListener; _hosts = hosts; _idGenerator = new IdGenerator(); _connections = new Dictionary <string, ServerConnection>(); _handlerFactory = handlerFactory; }
private static TestApiController CreateSubjectUnderTest( IHandlerFactory handlerFactory = null, IHandler<TestRequest> handler = null) { return new TestApiController( GetHandlerFactory(handlerFactory, handler)); }
public static async Task Run( [QueueTrigger("events", Connection = "AzureStorage")] EventPublishedNotification myQueueItem, ILogger log, [Inject] IHandlerFactory factory) { await factory.Dispatch(myQueueItem); }
/// <summary> /// Constructor /// </summary> /// <param name="handlerFactory">The request handler factory</param> public AbstractApiController( IHandlerFactory handlerFactory) { handlerFactory.NotNull(nameof(handlerFactory)); _handlerFactory = handlerFactory; }
public XmlReplyRouter( IReplyTypeMapper replyTypeMapper, IHandlerFactory handlerFactory) { _replyTypeMapper = replyTypeMapper; _handlerFactory = handlerFactory; }
public Deployer(ITemplateManager templateManager, IProvisionManager provisioningManager, IHandlerFactory handlerFactory, ITokeniser tokeniser) { this.templateManger = templateManager; this.provisioningManager = provisioningManager; this.handlerFactory = handlerFactory; this.tokeniser = tokeniser; }
public MessagesNancyModule(IMessageListViewModelRetriever messageListViewModelRetriever , IHandlerFactory handlerFactory) : base("/messages") { Get("/{storeName}/{pageNumber?1}", parameters => { var logger = LogProvider.GetLogger("MessagesNancyModule"); logger.Log(LogLevel.Debug, () => "GET on messages"); string storeName = parameters.storeName; int pageNumber = parameters.pageNumber; ViewModelRetrieverResult <MessageListModel, MessageListModelError> messageListModelResult = messageListViewModelRetriever.Get(storeName, pageNumber); if (!messageListModelResult.IsError) { return(Response.AsJson(messageListModelResult.Result)); } switch (messageListModelResult.Error) { case (MessageListModelError.StoreNotFound): return(Response.AsJson(new MessageViewerError( string.Format("Unknown store {0}", storeName)), HttpStatusCode.NotFound)); case (MessageListModelError.StoreMessageViewerNotImplemented): return(Response.AsJson(new MessageViewerError( string.Format("Found store {0} does not implement IMessageStoreViewer", storeName)), HttpStatusCode.NotFound)); case (MessageListModelError.StoreMessageViewerGetException): return(Response.AsJson(new MessageViewerError( string.Format("Unable to retrieve messages for store {0}", storeName)), HttpStatusCode.InternalServerError)); case (MessageListModelError.GetActivationStateFromConfigError): return(Response.AsJson(new MessageViewerError( string.Format("Misconfigured Message Viewer, unable to retrieve messages for store {0}", storeName)), HttpStatusCode.InternalServerError)); default: throw new Exception("Code can't reach here"); } }); Post("/{storeName}/repost/{msgList}", parameters => { try { var handler = handlerFactory.GetHandler <RepostCommand>(); string ids = parameters.msgList; var repostModelIds = ids.Split(','); var repostCommand = new RepostCommand { StoreName = parameters.storeName, MessageIds = repostModelIds.ToList() }; handler.Handle(repostCommand); return(Response.AsJson <int>(0, HttpStatusCode.OK)); } catch (Exception e) { return(e); } }); }
public FileWatcherService(IFolderMonitorFactory folderMonitorFactory, IHandlerFactory handlerFactory) { this.folderMonitorFactory = folderMonitorFactory; this.handlerFactory = handlerFactory; services = new Queue<FolderMonitor>(); InitializeComponent(); }
public ProductController(IProductRepository productRepository, IProductFactory productFactory, IHandlerFactory handlerFactory, IEnumerable <ICommandHandler> handlers) { this._productRepository = productRepository; this._productFactory = productFactory; this._handlerFactory = handlerFactory; this._handlers = handlers; }
/// <summary> /// Initializes a new instance of the <see cref="PostProcessingViewModel"/> /// class. /// </summary> /// <param name="factory">The <see cref="IHandlerFactory"/> providing /// information on the currently loaded handlers.</param> /// <param name="store">The <see cref="PostProcessingStore"/> containing /// details on the available kinds of options.</param> /// <exception cref="ArgumentNullException">factory or store are null</exception> public PostProcessingViewModel(IHandlerFactory factory, PostProcessingStore store) { if (factory == null) { throw new ArgumentNullException("factory"); } if (store == null) { throw new ArgumentNullException("store"); } _factory = factory; _store = store; _factory.HandlerRegistered += _handlerRegistered; AvailableOptions = new ObservableCollection <PostProcessingOptions>(); _continueCommand = new RelayCommand(_continue, _canContinue); foreach (string identifier in _store.AvailableOptions) { PostProcessingOptions options = _store[identifier]; options.Factory = _factory; AvailableOptions.Add(options); } if (AvailableOptions.Any()) { CurrentOptions = AvailableOptions.OrderBy(x => x.Identifier).First(); } _updateAvailableHandlers(); GoBackCommand = new RelayCommand(new Action <object>(_goBack)); }
public Receiver(IMessageLogger messageLogger, ConnectionConfiguration connectionConfiguration, IHandlerFactory handlerFactory) : base(messageLogger, connectionConfiguration) { this.messageLogger = messageLogger; this.handlerFactory = handlerFactory; }
public BaseDispatcher(BaseSerializer serializer, IHandlerFactory factory, OperationRuntimeModel model, ILoggerFactory logger, DescriptionRuntimeModel descriptionRuntimeModel) { _serializer = serializer; _factory = factory; Model = model; _descriptionRuntimeModel = descriptionRuntimeModel; Logger = logger.CreateLogger(GetType().FullName); }
public CommandBus(IHandlerFactory handlerFactory, ICommandQueue commandQueue, ILogger logger) { _handlerFactory = handlerFactory; _commandQueue = commandQueue; _logger = logger; _logger.SetSource(typeof(CommandBus).Name); }
public FileDataSourceService( ISourceDataContext context, IHandlerFactory handlerFactory, IStreamManager streamManager) : base(context) { this.streamManager = streamManager; this.handlerFactory = handlerFactory; }
public static void MessagesModule( this ConfigurableBootstrapper.ConfigurableBootstrapperConfigurator config, IMessageListViewModelRetriever messageListViewModelRetriever, IHandlerFactory handlerFactory) { config.Module <MessagesNancyModule>(); config.Dependencies <IMessageListViewModelRetriever>(messageListViewModelRetriever); config.Dependencies <IHandlerFactory>(handlerFactory); }
public ServiceDescriptor(Registry registry, ServiceRegistration serviceRegistration) { this.registry = registry; pluginDescriptor = (PluginDescriptor)serviceRegistration.Plugin; serviceId = serviceRegistration.ServiceId; serviceTypeName = serviceRegistration.ServiceTypeName; defaultComponentTypeName = serviceRegistration.DefaultComponentTypeName; traitsHandlerFactory = serviceRegistration.TraitsHandlerFactory; }
public WebSocketConnection(ISocket socket, IHandlerFactory handlerFactory) { Socket = socket; OnOpen = () => { }; OnClose = () => { }; OnMessage = x => { }; OnError = x => { }; _handlerFactory = handlerFactory; }
public ServiceDescriptor(Registry registry, ServiceRegistration serviceRegistration) { this.registry = registry; pluginDescriptor = (PluginDescriptor) serviceRegistration.Plugin; serviceId = serviceRegistration.ServiceId; serviceTypeName = serviceRegistration.ServiceTypeName; defaultComponentTypeName = serviceRegistration.DefaultComponentTypeName; traitsHandlerFactory = serviceRegistration.TraitsHandlerFactory; }
public OptionsBuilder WithHandlerFactory(Func <IOptionsContext, IHandlerFactory> resolver) { Guard.EnsureNotNull(resolver, nameof(resolver)); handlerFactory = resolver(this); Guard.EnsureNotNull(handlerFactory, nameof(handlerFactory)); return(this); }
public static void MessagesModule( this ConfigurableBootstrapper.ConfigurableBootstrapperConfigurator config, IMessageListViewModelRetriever messageListViewModelRetriever, IHandlerFactory handlerFactory) { config.Module<MessagesNancyModule>(); config.Dependencies<IMessageListViewModelRetriever>(messageListViewModelRetriever); config.Dependencies<IHandlerFactory>(handlerFactory); }
private void SetTheIocResolverIfIocHandlerFactory(IHandlerFactory aHandlerFactory) { var iocHandlerFactory = aHandlerFactory as IocHandlerFactory; if (iocHandlerFactory != null) { iocHandlerFactory.SetIocResolver(_iocResolver); } }
public OptionsBuilder WithHandlerFactory(Func<IOptionsContext, IHandlerFactory> resolver) { Guard.EnsureNotNull(resolver, nameof(resolver)); handlerFactory = resolver(this); Guard.EnsureNotNull(handlerFactory, nameof(handlerFactory)); return this; }
/// <summary> /// Initializes a new instance of the /// <see cref="LoadHandlersAssemblyCommand"/> class. /// </summary> /// <param name="factory">The <see cref="IHandlerFactory"/> this /// command will load assemblies into.</param> /// <exception cref="ArgumentNullException">factory is null</exception> public LoadHandlersAssemblyCommand(IHandlerFactory factory) { if (factory == null) { throw new ArgumentNullException("factory"); } Factory = factory; }
public PortsMiddleware(IHandlerFactory factory, IPublisher <ICommand> commandPublisher) : base(factory) { BeginHandle.Use((execution) => { IPublisher <ICommand> cronusCommandPublisher = new CronusPublisher <ICommand>(commandPublisher, execution.Context.CronusMessage); execution.Context.HandlerInstance.AssignPropertySafely <IPort>(x => x.CommandPublisher = cronusCommandPublisher); }); }
public Endpoint(ILog log, EndpointSettings settings, IFileSystem fileSystem, IListener listener, IHandlerFactory handlerFactory, IThreadManager threadManager) { this.log = log; this.settings = settings; this.fileSystem = fileSystem; this.listener = listener; this.handlerFactory = handlerFactory; this.threadManager = threadManager; }
public ApplicationServiceMiddleware(IHandlerFactory factory, IAggregateRepository aggregateRepository, IPublisher <IEvent> eventPublisher) : base(factory) { BeginHandle.Use((execution) => { IPublisher <IEvent> cronusEventPublisher = new CronusPublisher <IEvent>(eventPublisher, execution.Context.CronusMessage); var repo = new CronusAggregateRepository(aggregateRepository, cronusEventPublisher); execution.Context.HandlerInstance.AssignPropertySafely <IAggregateRootApplicationService>(x => x.Repository = repo); }); }
public QueryProcessor(IHandlerFactory handlerFactory) { if (handlerFactory == null) { throw new ArgumentNullException("handlerFactory"); } this.handlerFactory = handlerFactory; }
protected OpenTibiaProtocol(IHandlerFactory handlerFactory) { if (handlerFactory == null) { throw new ArgumentNullException(nameof(handlerFactory)); } HandlerFactory = handlerFactory; }
internal Options(ICommandRegistry commandRegistry, IHandlerFactory handlerFactory, CommandPipeline commandPipeline) { Guard.EnsureNotNull(commandRegistry, nameof(commandRegistry)); Guard.EnsureNotNull(handlerFactory, nameof(handlerFactory)); Guard.EnsureNotNull(commandPipeline, nameof(commandPipeline)); CommandRegistry = commandRegistry; HandlerFactory = handlerFactory; CommandPipeline = commandPipeline; }
/// <summary> /// Constructs a DefaultKernel with the specified /// implementation of <see cref = "IProxyFactory" /> and <see cref = "IDependencyResolver" /> /// </summary> /// <param name = "resolver"></param> /// <param name = "proxyFactory"></param> public DefaultKernel(IDependencyResolver resolver, IProxyFactory proxyFactory) { RegisterSubSystems(); ReleasePolicy = new LifecycledComponentsReleasePolicy(this); handlerFactory = new DefaultHandlerFactory(this); ComponentModelBuilder = new DefaultComponentModelBuilder(this); ProxyFactory = proxyFactory; this.resolver = resolver; resolver.Initialize(this, RaiseDependencyResolving); }
public HomeController(IUnitOfWork unitOfWork, IAppService appService, IHandlerFactory <IMessageParameterHandler> parameterHandlerFactory, IChainCreator <IChainHandler> chainCreator) { _unitOfWork = unitOfWork; _appService = appService; _parameterHandlerFactory = parameterHandlerFactory; _chainCreator = chainCreator; }
public ComponentDescriptor(Registry registry, ComponentRegistration componentRegistration) { this.registry = registry; pluginDescriptor = (PluginDescriptor) componentRegistration.Plugin; serviceDescriptor = (ServiceDescriptor) componentRegistration.Service; componentId = componentRegistration.ComponentId; componentTypeName = componentRegistration.ComponentTypeName ?? serviceDescriptor.DefaultComponentTypeName; componentProperties = componentRegistration.ComponentProperties.Copy().AsReadOnly(); traitsProperties = componentRegistration.TraitsProperties.Copy().AsReadOnly(); componentHandlerFactory = componentRegistration.ComponentHandlerFactory; }
internal HttpOptions(string commandPath, ICommandRegistry commandRegistry, IHandlerFactory handlerFactory, ICommandNameResolver commandNameResolver, CommandFactory commandFactory, CommandPipeline commandPipeline) : base(commandRegistry, handlerFactory, commandPipeline) { Guard.EnsureNotNullOrWhitespace(commandPath, nameof(commandPath)); Guard.EnsureNotNull(commandNameResolver, nameof(commandNameResolver)); Guard.EnsureNotNull(commandFactory, nameof(commandFactory)); CommandPath = commandPath; CommandNameResolver = commandNameResolver; CommandFactory = commandFactory; }
public MessagesNancyModule(IMessageListViewModelRetriever messageListViewModelRetriever, IHandlerFactory handlerFactory) : base("/messages") { Get("/{storeName}/{pageNumber?1}", parameters => { string storeName = parameters.storeName; int pageNumber = parameters.pageNumber; ViewModelRetrieverResult<MessageListModel, MessageListModelError> messageListModelResult = messageListViewModelRetriever.Get(storeName, pageNumber); if (!messageListModelResult.IsError) { return Response.AsJson(messageListModelResult.Result); } switch (messageListModelResult.Error) { case(MessageListModelError.StoreNotFound): return Response.AsJson(new MessageViewerError( string.Format("Unknown store {0}", storeName)), HttpStatusCode.NotFound); case (MessageListModelError.StoreMessageViewerNotImplemented): return Response.AsJson(new MessageViewerError( string.Format("Found store {0} does not implement IMessageStoreViewer", storeName)), HttpStatusCode.NotFound); case (MessageListModelError.StoreMessageViewerGetException): return Response.AsJson(new MessageViewerError( string.Format("Unable to retrieve messages for store {0}", storeName)), HttpStatusCode.InternalServerError); case (MessageListModelError.GetActivationStateFromConfigError): return Response.AsJson(new MessageViewerError( string.Format("Misconfigured Message Viewer, unable to retrieve messages for store {0}", storeName)), HttpStatusCode.InternalServerError); default: throw new Exception("Code can't reach here"); } }); Post("/{storeName}/repost/{msgList}", parameters => { try { var handler = handlerFactory.GetHandler<RepostCommand>(); string ids = parameters.msgList; var repostModelIds = ids.Split(','); var repostCommand = new RepostCommand { StoreName = parameters.storeName, MessageIds = repostModelIds.ToList() }; handler.Handle(repostCommand); return Response.AsJson<int>(0, HttpStatusCode.OK); } catch (Exception e) { return e; } }); }
public PluginDescriptor(Registry registry, PluginRegistration pluginRegistration, IList<IPluginDescriptor> completePluginDependenciesCopy) { this.registry = registry; pluginId = pluginRegistration.PluginId; pluginTypeName = pluginRegistration.PluginTypeName; baseDirectory = pluginRegistration.BaseDirectory; pluginProperties = pluginRegistration.PluginProperties.Copy().AsReadOnly(); traitsProperties = pluginRegistration.TraitsProperties.Copy().AsReadOnly(); pluginHandlerFactory = pluginRegistration.PluginHandlerFactory; assemblyBindings = new ReadOnlyCollection<AssemblyBinding>(GenericCollectionUtils.ToArray(pluginRegistration.AssemblyBindings)); pluginDependencies = new ReadOnlyCollection<IPluginDescriptor>(completePluginDependenciesCopy); probingPaths = new ReadOnlyCollection<string>(GenericCollectionUtils.ToArray(pluginRegistration.ProbingPaths)); enableCondition = pluginRegistration.EnableCondition; recommendedInstallationPath = pluginRegistration.RecommendedInstallationPath; filePaths = new ReadOnlyCollection<string>(GenericCollectionUtils.ToArray(pluginRegistration.FilePaths)); }
// Used by unit tests. internal static void RunWithInjectedTraitsHandlerFactoryMock(IHandlerFactory traitsHandlerFactory, Action action) { IHandlerFactory oldTraitsHandlerFactory = traitsHandlerFactory; try { PluginDescriptor.traitsHandlerFactory = traitsHandlerFactory; action(); } finally { PluginDescriptor.traitsHandlerFactory = oldTraitsHandlerFactory; } }
public ElasticSearchSubscription(string name, Type messageType, IHandlerFactory factory) : base(name, messageType, factory.MessageHandlerType) { handlerFactory = factory; }
public void Setup() { defaultHandlerFactory = new StructureMapHandlerFactory(); }
public Configuration HandlerFactoryOf(IHandlerFactory handlerFactory) { HandlerFactory = handlerFactory; return this; }
public static void SetHandlerFactory(IHandlerFactory handlerFactory) { factory = handlerFactory; }
private static IHandlerFactory GetHandlerFactory( IHandlerFactory handlerFactory, IHandler<TestRequest> handler) { if (handlerFactory.IsNull()) handlerFactory = Mock.Of<IHandlerFactory>(); if (handler.IsNull()) handler = GetHandler(); Mock.Get(handlerFactory) .Setup(f => f.GetHandler<TestRequest>()) .Returns(handler); return handlerFactory; }
public void Setup() { defaultHandlerFactory = new DefaultHandlerFactory(); }
public void Setup() { factory = Substitute.For<IHandlerFactory>(); container = new HandlerContainer(factory); }
public ResponseProvider(IHandlerFactory handlerFactory) { this.startHandler = handlerFactory.CreateAndAttachHandlers(); }
public IHandlerFactory GetServiceMethodHandlerFactory() { return handlerFactory ?? (handlerFactory = overrides.ServiceMethodHandlerFactory != null ? overrides.ServiceMethodHandlerFactory(this) : new HandlerFactory(GetCodecContainer(), GetServiceMethodDelegateFactory())); }
public SimpleMessagingService(IHandlerFactory handerFactory) { this.handlerFactory = handerFactory; }
public TestSubscription(Type messageType, IHandlerFactory factory) : base("Elders.Cronus.Tests", messageType, factory.MessageHandlerType) { Factory = factory; }
public EventDispatcher(IHandlerFactory factory) { Condition.Requires(factory, "factory").IsNotNull(); this.factory = factory; }
public TestApiController(IHandlerFactory factory) : base(factory) { }
public RequestHandler(IHandlerFactory handlerFactory) { _handlerFactory = handlerFactory; }
public HandlerContainer(IHandlerFactory factory) { this.factory = factory; handlers = new ConcurrentDictionary<ServicePath, IHandler>(); }