public void SetUp() { string masterNodeAddress = "MasterNode"; gatewayAddress = masterNodeAddress + ".Gateway"; messageSender = MockRepository.GenerateStub<ISendMessages>(); var masterNodeManager = MockRepository.GenerateStub<IManageTheMasterNode>(); var builder = MockRepository.GenerateStub<IBuilder>(); builder.Stub(x => x.BuildAll<IMutateOutgoingMessages>()).Return(new IMutateOutgoingMessages[] { }); builder.Stub(x => x.BuildAll<IMutateOutgoingTransportMessages>()).Return(new IMutateOutgoingTransportMessages[] { headerManager}); masterNodeManager.Stub(x => x.GetMasterNode()).Return(masterNodeAddress); bus = new UnicastBus { MessageSerializer = MockRepository.GenerateStub<IMessageSerializer>(), Builder = builder, MasterNodeManager = masterNodeManager, MessageSender = messageSender }; ExtensionMethods.SetHeaderAction = headerManager.SetHeader; ((IStartableBus)bus).Start(); }
public void SetUp() { testSender = MockRepository.GenerateStub <ISendMessages>(); messagePersister = new InMemoryPersistence(); HttpChannelReceiver = new HttpChannelReceiver(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", ReturnAddress = "Gateway.Tests.Input" }; HttpChannelReceiver.MessageReceived += httpChannel_MessageReceived; HttpChannelReceiver.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus(DATABUS_DIRECTORY) .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
public GatewayService(IDispatchMessagesToChannels channelDispatcher, ISendMessages messageSender) { this.channelDispatcher = channelDispatcher; channels = Configure.Instance.Builder.BuildAll <IChannelReceiver>(); this.messageSender = messageSender; }
public void SetUp() { string masterNodeAddress = "MasterNode"; gatewayAddress = masterNodeAddress + ".Gateway"; messageSender = MockRepository.GenerateStub <ISendMessages>(); var masterNodeManager = MockRepository.GenerateStub <IManageTheMasterNode>(); var builder = MockRepository.GenerateStub <IBuilder>(); builder.Stub(x => x.BuildAll <IMutateOutgoingMessages>()).Return(new IMutateOutgoingMessages[] { }); builder.Stub(x => x.BuildAll <IMutateOutgoingTransportMessages>()).Return(new IMutateOutgoingTransportMessages[] { headerManager }); masterNodeManager.Stub(x => x.GetMasterNode()).Return(masterNodeAddress); bus = new UnicastBus { MessageSerializer = MockRepository.GenerateStub <IMessageSerializer>(), Builder = builder, MasterNodeManager = masterNodeManager, MessageSender = messageSender }; ExtensionMethods.SetHeaderAction = headerManager.SetHeader; ((IStartableBus)bus).Start(); }
public void SetUp() { testSender = MockRepository.GenerateStub<ISendMessages>(); messagePersister = new InMemoryPersistence(); httpChannel = new HttpChannel(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", ReturnAddress = "Gateway.Tests.Input" }; httpChannel.MessageReceived += httpChannel_MessageReceived; httpChannel.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus("./databus") .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
protected void SendMessages(ISendMessages sender, int count) { for (var i = 0; i < count; i++) { sender.Send(GenerateTransportMessage(i, "MessageType"), ReceiverAddress); } }
public HttpRequestHandler(string inputQueue, ISendMessages sender, string queue, string connectionString) { this.inputQueue = inputQueue; messageSender = sender; destinationQueue = queue; connString = connectionString; }
public ConfigurationTabViewModel( IPersistedRunnerConfig config, ScenarioRunner runner, IEnumerable<IResultFormatter<ScenarioInRunResult>> formatters, IEventAggregator eventAggregator, ISendMessages sender, ISelectableScenarios scenarios, ISelectableConfigurations configurations, ISelectableFormatters compiledFormatters) { _config = config; _runner = runner; _formatters = formatters; _sender = sender; _scenarios = scenarios; _selectableFormatters = compiledFormatters; _selectableConfigurations = configurations.SelectableConfigurations; foreach (var c in _selectableConfigurations) { c.IsSelected = !_config.IgnoredConfigurations.Contains(c.Name); } foreach (var f in _selectableFormatters.SelectableFormatters) { f.IsSelected = !_config.IgnoredFormatters.Contains(f.Formatter.Name); } foreach (var s in _scenarios.SelectableScenarios) { s.IsSelected = !_config.IgnoredScenarios.Contains(s.Scenario.Name); } NumberOfIterations = config.NumberOfRuns; eventAggregator.Subscribe(this); }
/// <summary> /// Initializes a new instance of the <see cref="ProducerQueueRpc{T}" /> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sendMessages">The send messages.</param> /// <param name="responseIdFactory">The response identifier factory.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="rpcTimeoutFactory">The RPC timeout factory.</param> /// <param name="generateMessageHeaders">The generate message headers.</param> /// <param name="addStandardMessageHeaders">The add standard message headers.</param> public ProducerQueueRpc( QueueProducerConfiguration configuration, ISendMessages sendMessages, IResponseIdFactory responseIdFactory, IMessageFactory messageFactory, IRpcTimeoutFactory rpcTimeoutFactory, GenerateMessageHeaders generateMessageHeaders, AddStandardMessageHeaders addStandardMessageHeaders) { Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => sendMessages, sendMessages); Guard.NotNull(() => responseIdFactory, responseIdFactory); Guard.NotNull(() => messageFactory, messageFactory); Guard.NotNull(() => rpcTimeoutFactory, rpcTimeoutFactory); Guard.NotNull(() => generateMessageHeaders, generateMessageHeaders); Guard.NotNull(() => addStandardMessageHeaders, addStandardMessageHeaders); _configuration = configuration; _sendMessages = sendMessages; _responseIdFactory = responseIdFactory; _messageFactory = messageFactory; _rpcTimeoutFactory = rpcTimeoutFactory; _generateMessageHeaders = generateMessageHeaders; _addStandardMessageHeaders = addStandardMessageHeaders; }
public ConfigurationTabViewModel( IPersistedRunnerConfig config, ScenarioRunner runner, IEnumerable <IResultFormatter <ScenarioInRunResult> > formatters, IEventAggregator eventAggregator, ISendMessages sender, ISelectableScenarios scenarios, ISelectableConfigurations configurations, ISelectableFormatters compiledFormatters) { _config = config; _runner = runner; _formatters = formatters; _sender = sender; _scenarios = scenarios; _selectableFormatters = compiledFormatters; _selectableConfigurations = configurations.SelectableConfigurations; foreach (var c in _selectableConfigurations) { c.IsSelected = !_config.IgnoredConfigurations.Contains(c.Name); } foreach (var f in _selectableFormatters.SelectableFormatters) { f.IsSelected = !_config.IgnoredFormatters.Contains(f.Formatter.Name); } foreach (var s in _scenarios.SelectableScenarios) { s.IsSelected = !_config.IgnoredScenarios.Contains(s.Scenario.Name); } NumberOfIterations = config.NumberOfRuns; eventAggregator.Subscribe(this); }
public RetryProcessor(ISendMessages sender, IBus bus, ReturnToSenderDequeuer returnToSender, RetryOperationManager retryOperationManager) { this.sender = sender; this.bus = bus; this.returnToSender = returnToSender; this.retryOperationManager = retryOperationManager; }
public void SetUp() { testSender = MockRepository.GenerateStub <ISendMessages>(); messagePersister = new InMemoryPersistence(); dataBusForTheReceivingSide = new FileShareDataBus(DATABUS_DIRECTORY); HttpChannelReceiver = new HttpChannelReceiver(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", DataBus = dataBusForTheReceivingSide }; HttpChannelReceiver.MessageReceived += httpChannel_MessageReceived; HttpChannelReceiver.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus(DATABUS_DIRECTORY_FOR_THE_TEST_ENDPOINT) .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
public OutgoingMessageLogger(ISendMessages sender, LogLevel logLevel) { Guard.IsNotNull(sender, nameof(sender)); _sender = sender; _logLevel = logLevel; }
/// <summary> /// Initializes a new instance of the <see cref="SendMessagesDecorator"/> class. /// </summary> /// <param name="handler">The handler.</param> /// <param name="tracer">The tracer.</param> /// <param name="headers">The headers.</param> /// <param name="connectionInformation">The connection information.</param> public SendMessagesDecorator(ISendMessages handler, ITracer tracer, IHeaders headers, IConnectionInformation connectionInformation) { _handler = handler; _tracer = tracer; _headers = headers; _connectionInformation = connectionInformation; }
public GatewayService(IDispatchMessagesToChannels channelDispatcher, ISendMessages messageSender) { this.channelDispatcher = channelDispatcher; channels = Configure.Instance.Builder.BuildAll<IChannelReceiver>(); this.messageSender = messageSender; }
public void SetUp() { testSender = MockRepository.GenerateStub<ISendMessages>(); messagePersister = new InMemoryPersistence(); dataBusForTheReceivingSide = new FileShareDataBus(DATABUS_DIRECTORY); HttpChannelReceiver = new HttpChannelReceiver(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", DataBus = dataBusForTheReceivingSide }; HttpChannelReceiver.MessageReceived += httpChannel_MessageReceived; HttpChannelReceiver.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus(DATABUS_DIRECTORY_FOR_THE_TEST_ENDPOINT) .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
/// <summary> /// Scans the dlls and creates a dictionary in which each message in IFunctions is referenced to each function. /// </summary> public HandlersContainer(string serviceName, bool lockSaga = true) { lock (o) { this.serviceName = serviceName; this.lockSaga = SettingsUtil.HasSettings(SETTINGS.LOCKSAGAS)? SettingsUtil.GetSettings <bool>(SETTINGS.LOCKSAGAS):lockSaga; AddDependency <ISerializeMessages, JSONSerializer>(); AddDependency <ISagaLocker, SagaAzureStorageLocker>(); AddDependency <ISendMessages, AzureStorageQueueSendTransport>(SolveDependency <ISerializeMessages>()); AddDependency <IPublishEvents, AzureEventHubPublishTransport>(SolveDependency <ISerializeMessages>()); this.serializer = SolveDependency <ISerializeMessages>(); this.sagaLocker = SolveDependency <ISagaLocker>(); AddDependency <ISagaStoragePersistence, SagaAzureStoragePersistence>(this.sagaLocker as ISagaLocker, this.lockSaga); sagaPersistence = SolveDependency <ISagaStoragePersistence>(); messageSender = SolveDependency <ISendMessages>(); var assemblies = new List <Assembly>(); assemblies.Add(Assembly.GetCallingAssembly()); assemblies.AddRange(Assembly.GetCallingAssembly().GetReferencedAssemblies().Select(a => Assembly.Load(a.FullName))); var types = assemblies.SelectMany(a => a.GetTypes()); LookForSagas(types); LookForHandlers(types); this.sagaLocker.CreateLocksContainer(); sagaPersistence.CreateSagaPersistenceTableAsync().Wait(); } }
public RegisterWrappers(ISendMessages sender, IPublishMessages publisher, IDeferMessages defer, ScenarioContext sc, ReadOnlySettings settings) { var container = settings.Get <IConfigureComponents>("SC.ConfigureComponent"); container.RegisterSingleton(typeof(ISendMessages), new SendMessagesWrapper(sender, sc)); container.RegisterSingleton(typeof(IPublishMessages), new PublishMessagesWrapper(publisher, sc)); container.RegisterSingleton(typeof(IDeferMessages), new DeferMessagesWrapper(defer, sc)); }
/// <summary> /// Initializes a new instance of <see cref="CommandPublisher"/>. /// </summary> /// <param name="messageFactory">The message factory.</param> /// <param name="messageSender">The message sender.</param> public CommandPublisher(ICreateMessages messageFactory, ISendMessages <CommandEnvelope> messageSender) { Verify.NotNull(messageFactory, nameof(messageFactory)); Verify.NotNull(messageSender, nameof(messageSender)); this.messageFactory = messageFactory; this.messageSender = messageSender; }
public HttpRequestHandler(ISendMessages sender, IMessageNotifier notifier, string inputQueue, string queue, string connectionString) { this.inputQueue = inputQueue; this.notifier = notifier; messageSender = sender; destinationQueue = queue; connString = connectionString; }
/// <summary> /// Initializes a new instance of <see cref="EventPublisher"/>. /// </summary> /// <param name="messageFactory">The message factory.</param> /// <param name="messageSender">The message sender.</param> public EventPublisher(ICreateMessages messageFactory, ISendMessages<EventEnvelope> messageSender) { Verify.NotNull(messageFactory, nameof(messageFactory)); Verify.NotNull(messageSender, nameof(messageSender)); this.messageFactory = messageFactory; this.messageSender = messageSender; }
public WhenSendingMessages() { serializer = new BinarySerializer(); messageSender = new MessageSender <String>(TestMessageQueue.Path, serializer); testQueue = TestMessageQueue.Create(); testQueue.EnsureQueueExists(); testQueue.Purge(); }
public GatewayService(IDispatchMessagesToChannels channelDispatcher, ISendMessages messageSender) { this.channelDispatcher = channelDispatcher; channels = Configure.Instance.Builder.BuildAll <IChannelReceiver>(); //todo abstract this behind another interface this.messageSender = messageSender; }
public ServiceControlBackend(ISendMessages messageSender) { this.messageSender = messageSender; serializer = new JsonMessageSerializer(new SimpleMessageMapper()); serviceControlBackendAddress = GetServiceControlAddress(); VerifyIfServiceControlQueueExists(); }
public GatewayService(IDispatchMessagesToChannels channelDispatcher, ISendMessages messageSender) { this.channelDispatcher = channelDispatcher; channels = Configure.Instance.Builder.BuildAll<IChannelReceiver>(); //todo abstract this behind another interface this.messageSender = messageSender; }
public RetryProcessor(ISendMessages sender, IBus bus, ReturnToSenderDequeuer returnToSender, RetryingManager retryingManager) { this.sender = sender; this.bus = bus; this.returnToSender = returnToSender; this.retryingManager = retryingManager; corruptedReplyToHeaderStrategy = new CorruptedReplyToHeaderStrategy(RuntimeEnvironment.MachineName); }
public WhenSendingMessages() { serializer = new BinarySerializer(); messageSender = new MessageSender<String>(TestMessageQueue.Path, serializer); testQueue = TestMessageQueue.Create(); testQueue.EnsureQueueExists(); testQueue.Purge(); }
protected override void DoSetUp() { factory = new TFactory(); var transports = factory.Create(); sender = transports.Item1; receiver = transports.Item2; }
public RunnableInsertScenario( IPerformanceScenarioBuilder <InsertContext> builder, IProvideRunnableConfigurations configurationProvider, ISendMessages sender) { _configurationProvider = configurationProvider; _builder = builder; _sender = sender; }
public RunnableInsertScenario( IPerformanceScenarioBuilder<InsertContext> builder, IProvideRunnableConfigurations configurationProvider, ISendMessages sender) { _configurationProvider = configurationProvider; _builder = builder; _sender = sender; }
public RetryProcessor(IBodyStorage bodyStorage, ISendMessages sender, IDocumentStore store, IBus bus, ReturnToSenderDequeuer returnToSender) { executor = new PeriodicExecutor(Process, TimeSpan.FromSeconds(30), ex => Log.Error("Error during retry batch processing", ex)); this.bodyStorage = bodyStorage; this.sender = sender; this.store = store; this.bus = bus; this.returnToSender = returnToSender; }
public TimerBasedPeriodicCheck(IPeriodicCheck periodicCheck, ISendMessages messageSender, Configure configure, UnicastBus unicastBus, CriticalError criticalError) { this.periodicCheck = periodicCheck; this.configure = configure; this.unicastBus = unicastBus; serviceControlBackend = new ServiceControlBackend(messageSender, configure, criticalError); timer = new Timer(Run, null, TimeSpan.Zero, periodicCheck.Interval); }
public MessageStreamerConnection(ISendMessages sender, ReadOnlySettings settings, Conventions conventions) { this.sender = sender; messageTypes = settings.GetAvailableTypes() .Where(conventions.IsMessageType) .ToList(); localAddress = settings.LocalAddress(); }
public TransactionalChannelDispatcher(IChannelFactory channelFactory, IMessageNotifier notifier, ISendMessages messageSender, IRouteMessages routeMessages) { this.routeMessages = routeMessages; this.channelFactory = channelFactory; this.notifier = notifier; this.messageSender = messageSender; }
public ManageMessageFailuresWithoutSlr(IManageMessageFailures mainFailureManager, ISendMessages messageSender, Configure config) { this.messageSender = messageSender; this.config = config; var mainTransportFailureManager = mainFailureManager as Faults.Forwarder.FaultManager; if (mainTransportFailureManager != null) { errorQueue = mainTransportFailureManager.ErrorQueue; } }
void Initialize(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages) { this.storeTimeouts = storeTimeouts; rebusBus = new RebusBus(this, sendMessages, receiveMessages, null, null, null, new JsonMessageSerializer(), new TrivialPipelineInspector(), new ErrorTracker(receiveMessages.InputQueueAddress + ".error")); bus = rebusBus; timer.Interval = 300; timer.Elapsed += CheckCallbacks; }
public RijndaelEncryptionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages, string ivBase64, string keyBase64) { this.innerSendMessages = innerSendMessages; this.innerReceiveMessages = innerReceiveMessages; Rijndael.IV = Convert.FromBase64String(ivBase64); Rijndael.Key = Convert.FromBase64String(keyBase64); encryptor = Rijndael.CreateEncryptor(); decryptor = Rijndael.CreateDecryptor(); }
public RunnableBulkSelectScenario( IPerformanceScenarioBuilder<SelectContext> builder, IProvideRunnableConfigurations configurationProvider, InsertContext insertTestContext, ISendMessages sender) { _configurationProvider = configurationProvider; _builder = builder; _textContext = insertTestContext; _sender = sender; }
public RunnableUpdateScenario( IPerformanceScenarioBuilder <UpdateContext> builder, IProvideRunnableConfigurations configurationProvider, InsertContext insertTestContext, ISendMessages sender) { _configurationProvider = configurationProvider; _builder = builder; _textContext = insertTestContext; _sender = sender; }
public GatewaySender( IBuilder builder, IMangageReceiveChannels channelManager, IMessageNotifier notifier, ISendMessages messageSender, IMainEndpointSettings settings) { this.settings = settings; this.builder = builder; this.channelManager = channelManager; this.notifier = notifier; this.messageSender = messageSender; }
public GatewaySender(IBuilder builder, IMangageReceiveChannels channelManager, IMessageNotifier notifier, ISendMessages messageSender, IMainEndpointSettings settings) { this.settings = settings; this.builder = builder; this.channelManager = channelManager; this.notifier = notifier; this.messageSender = messageSender; }
public GatewayReceiver( IMangageReceiveChannels channelManager, IRouteMessagesToEndpoints endpointRouter, IBuilder builder, ISendMessages messageSender) { this.messageSender = messageSender; this.channelManager = channelManager; this.endpointRouter = endpointRouter; this.builder = builder; activeReceivers = new List<IReceiveMessagesFromSites>(); }
protected override void DoSetUp() { activateHandlers = new HandlerActivatorForTesting(); determineMessageOwnership = Mock<IDetermineMessageOwnership>(); sendMessages = Mock<ISendMessages>(); serializeMessages = new JsonMessageSerializer(); storeSagaData = Mock<IStoreSagaData>(); receiveMessages = new MessageReceiverForTesting(serializeMessages); inspectHandlerPipeline = new TrivialPipelineInspector(); storeSubscriptions = Mock<IStoreSubscriptions>(); bus = CreateTheBus(); bus.Start(); }
public GatewayReceiver(IMangageReceiveChannels channelManager, IRouteMessagesToEndpoints endpointRouter, IBuilder builder, ISendMessages messageSender) { this.messageSender = messageSender; this.channelManager = channelManager; this.endpointRouter = endpointRouter; this.builder = builder; activeReceivers = new List <IReceiveMessagesFromSites>(); }
public DistributorSatellite(IBuilder builder, ReadOnlySettings settings) { disable = !settings.GetOrDefault<bool>("Distributor.Enabled"); if (disable) { return; } messageSender = builder.Build<ISendMessages>(); workerManager = builder.Build<IWorkerAvailabilityManager>(); address = MasterNodeConfiguration.GetMasterNodeAddress(settings); }
protected override void DoSetUp() { activateHandlers = new HandlerActivatorForTesting(); determineDestination = Mock <IDetermineDestination>(); sendMessages = Mock <ISendMessages>(); serializeMessages = new JsonMessageSerializer(); storeSagaData = Mock <IStoreSagaData>(); receiveMessages = new MessageReceiverForTesting(serializeMessages); inspectHandlerPipeline = new TrivialPipelineInspector(); storeSubscriptions = Mock <IStoreSubscriptions>(); bus = CreateTheBus(); bus.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="SendMessagesDecorator" /> class. /// </summary> /// <param name="metrics">The metrics factory.</param> /// <param name="handler">The handler.</param> /// <param name="connectionInformation">The connection information.</param> public SendMessagesDecorator(IMetrics metrics, ISendMessages handler, IConnectionInformation connectionInformation) { var name = handler.GetType().Name; _sendTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendTimer", Units.Calls); _sendBatchTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchTimer", Units.Calls); _sendAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendAsyncTimer", Units.Calls); _sendBatchAsyncTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.SendBatchAsyncTimer", Units.Calls); _sendMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesMeter", Units.Items, TimeUnits.Minutes); _sendErrorMeter = metrics.Meter($"{connectionInformation.QueueName}.{name}.SendMessagesErrorMeter", Units.Items, TimeUnits.Minutes); _handler = handler; }
public When_the_messaging_service_processes_an_LRAP1Attachment_submission() { //Arrange _fakeCommsService = A.Fake<ICommsService>(); _fakeMessageSender = A.Fake<ISendMessages>(); _sut = new Lrap1Processor(_fakeMessageSender, _fakeCommsService); _command = new SubmitLrap1AttachmentCommand() { AttachmentId = "9876543210", ApplicationId = "123456789", Username = "******", Password = "******", Payload = "Payload" }; }
public void Init() { NServiceBus.Configure.With().Log4Net().DefaultBuilder().UnicastBus(); string errorQueue = ConfigurationManager.AppSettings["ErrorQueue"]; string audit = ConfigurationManager.AppSettings["ForwardReceivedMessageTo"]; string listenUrl = ConfigurationManager.AppSettings["ListenUrl"]; string n = ConfigurationManager.AppSettings["NumberOfWorkerThreads"]; string remoteUrl = ConfigurationManager.AppSettings["RemoteUrl"]; connectionString = ConfigurationManager.AppSettings["ConnectionString"]; inputQueue = ConfigurationManager.AppSettings["InputQueue"]; outputQueue = ConfigurationManager.AppSettings["OutputQueue"]; int numberOfWorkerThreads = 10; int.TryParse(n, out numberOfWorkerThreads); ThreadPool.SetMaxThreads(numberOfWorkerThreads, numberOfWorkerThreads); messageSender = new MsmqMessageSender {UseDeadLetterQueue = true, UseJournalQueue = true}; transport = new TransactionalTransport { MessageReceiver = new MsmqMessageReceiver(), IsTransactional = true, NumberOfWorkerThreads = numberOfWorkerThreads }; notifier = new MessageNotifier(); NServiceBus.Configure.Instance.Configurer.RegisterSingleton<ISendMessages>(messageSender); NServiceBus.Configure.Instance.Configurer.RegisterSingleton<ITransport>(transport); NServiceBus.Configure.Instance.Configurer.RegisterSingleton<INotifyAboutMessages>(notifier); transport.TransportMessageReceived += (s, e) => { new MsmqHandler(notifier, listenUrl).Handle(e.Message, remoteUrl); if (!string.IsNullOrEmpty(audit)) messageSender.Send(e.Message, audit); }; listener = new HttpListener(); listener.Prefixes.Add(listenUrl); }
public ServiceControlBackend(ISendMessages messageSender, Configure configure, CriticalError criticalError) { this.configure = configure; this.criticalError = criticalError; this.messageSender = messageSender; serializer = new JsonMessageSerializer(new SimpleMessageMapper()); serviceControlBackendAddress = GetServiceControlAddress(); VerifyIfServiceControlQueueExists(); circuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("ServiceControlConnectivity", TimeSpan.FromMinutes(2), ex => criticalError.Raise( "This endpoint is repeatedly unable to contact the ServiceControl backend to report endpoint information. You have the ServiceControl plugins installed in your endpoint. However, please ensure that the Particular ServiceControl service is installed on this machine, " + "or if running ServiceControl on a different machine, then ensure that your endpoint's app.config / web.config, AppSettings has the following key set appropriately: ServiceControl/Queue. \r\n" + @"For example: <add key=""ServiceControl/Queue"" value=""particular.servicecontrol@machine""/>" + "\r\n", ex)); }
public void Init() { NServiceBus.Configure.With().DefaultBuilder(); string errorQueue = ConfigurationManager.AppSettings["ErrorQueue"]; string audit = ConfigurationManager.AppSettings["ForwardReceivedMessageTo"]; string listenUrl = ConfigurationManager.AppSettings["ListenUrl"]; string n = ConfigurationManager.AppSettings["NumberOfWorkerThreads"]; string req = ConfigurationManager.AppSettings["RequireMD5FromClient"]; string remoteUrl = ConfigurationManager.AppSettings["RemoteUrl"]; inputQueue = ConfigurationManager.AppSettings["InputQueue"]; outputQueue = ConfigurationManager.AppSettings["OutputQueue"]; int numberOfWorkerThreads = 10; int.TryParse(n, out numberOfWorkerThreads); bool.TryParse(req, out requireMD5FromClient); ThreadPool.SetMaxThreads(numberOfWorkerThreads, numberOfWorkerThreads); messageSender = new MsmqMessageSender(); transport = new TransactionalTransport { MessageReceiver = new MsmqMessageReceiver(), IsTransactional = true, NumberOfWorkerThreads = numberOfWorkerThreads }; transport.TransportMessageReceived += (s, e) => { new MsmqHandler(listenUrl).Handle(e.Message, remoteUrl); if (!string.IsNullOrEmpty(audit)) messageSender.Send(e.Message, audit); }; listener = new HttpListener(); listener.Prefixes.Add(listenUrl); }
public void SetUp() { string localAddress = "endpointA"; Address masterNodeAddress = localAddress + "@MasterNode"; try { Address.InitializeLocalAddress(localAddress); } catch // intentional { } ExtensionMethods.IsMessageTypeAction = t => typeof(IMessage).IsAssignableFrom(t) && t != typeof(IMessage); ExtensionMethods.GetStaticOutgoingHeadersAction = () => MessageHeaderManager.staticHeaders; gatewayAddress = masterNodeAddress.SubScope("gateway"); messageSender = MockRepository.GenerateStub<ISendMessages>(); var masterNodeManager = MockRepository.GenerateStub<IManageTheMasterNode>(); var builder = MockRepository.GenerateStub<IBuilder>(); builder.Stub(x => x.BuildAll<IMutateOutgoingMessages>()).Return(new IMutateOutgoingMessages[] { }); builder.Stub(x => x.BuildAll<IMutateOutgoingTransportMessages>()).Return(new IMutateOutgoingTransportMessages[] { headerManager }); masterNodeManager.Stub(x => x.GetMasterNode()).Return(masterNodeAddress); unicastBus = new UnicastBus { MessageSerializer = MockRepository.GenerateStub<IMessageSerializer>(), Builder = builder, MasterNodeManager = masterNodeManager, MessageSender = messageSender, Transport = MockRepository.GenerateStub<ITransport>() }; bus = unicastBus; ExtensionMethods.SetHeaderAction = headerManager.SetHeader; ((IStartableBus)bus).Start(); }
public StorageDrivenPublisher(ISendMessages messageSender, IStoreSubscriptions subscriptionStorage) { this.messageSender = messageSender; this.subscriptionStorage = subscriptionStorage; }
public PersonController(IQueryStorage store, ISendMessages bus) { this.store = store; this.bus = bus; }