Task DispatchUnicast(IEnumerable <UnicastTransportOperation> operations, TransportTransaction transaction) { return(Task.WhenAll(operations.Select(operation => { PathChecker.ThrowForBadPath(operation.Destination, "message destination"); return WriteMessage(operation.Destination, operation, transaction); }))); }
/// <summary> /// Configures a custom path where host diagnostics is written. /// </summary> /// <param name="config">Configuration object to extend.</param> /// <param name="path">The custom path to use.</param> public static void SetDiagnosticsPath(this EndpointConfiguration config, string path) { Guard.AgainstNull(nameof(config), config); Guard.AgainstNullAndEmpty(nameof(path), path); PathChecker.ThrowForBadPath(path, "Diagnostics root path"); config.GetSettings().Set(DiagnosticsPathKey, path); }
public AcceptanceTestTransportInfrastructure(SettingsHolder settings) { this.settings = settings; if (!settings.TryGet(StorageLocationKey, out storagePath)) { storagePath = FindStoragePath(); } var errorQueueAddress = settings.ErrorQueueAddress(); PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); }
public override TransportSubscriptionInfrastructure ConfigureSubscriptionInfrastructure() { return(new TransportSubscriptionInfrastructure(() => { var endpointName = settings.EndpointName(); PathChecker.ThrowForBadPath(endpointName, "endpoint name"); var localAddress = settings.LocalAddress(); PathChecker.ThrowForBadPath(localAddress, "localAddress"); return new LearningTransportSubscriptionManager(storagePath, endpointName, localAddress); })); }
public LearningTransportInfrastructure(SettingsHolder settings) { this.settings = settings; if (!settings.TryGet(StorageLocationKey, out storagePath)) { storagePath = FindStoragePath(); } if (settings.TryGet <ReceiveComponent.Settings>(out var receiveSettings)) { receiveSettings.SetDefaultPushRuntimeSettings(new PushRuntimeSettings(1)); } var errorQueueAddress = settings.ErrorQueueAddress(); PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); }
public LearningTransportInfrastructure(SettingsHolder settings) { this.settings = settings; if (!settings.TryGet(StorageLocationKey, out storagePath)) { storagePath = FindStoragePath(); } settings.SetDefault(new MessageProcessingOptimizationExtensions.ConcurrencyLimit { MaxValue = 1 }); var errorQueueAddress = settings.ErrorQueueAddress(); PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); }
public IMessageReceiver CreateReceiver(ReceiveSettings receiveSettings) { var errorQueueAddress = receiveSettings.ErrorQueue; PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); PathChecker.ThrowForBadPath(settings.Name, "endpoint name"); ISubscriptionManager subscriptionManager = null; if (receiveSettings.UsePublishSubscribe) { subscriptionManager = new LearningTransportSubscriptionManager(storagePath, settings.Name, receiveSettings.ReceiveAddress); } var pump = new LearningTransportMessagePump(receiveSettings.Id, storagePath, settings.CriticalErrorAction, subscriptionManager, receiveSettings, transport.TransportTransactionMode); return(pump); }
public TestTransportInfrastructure(SettingsHolder settings) { this.settings = settings; if (!settings.TryGet(StorageLocationKey, out storagePath)) { var solutionRoot = FindSolutionRoot(); storagePath = Path.Combine(solutionRoot, ".learningtransport"); } var errorQueueAddress = settings.ErrorQueueAddress(); PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); OutboundRoutingPolicy = settings.GetOrDefault <bool>(NoNativePubSub) ? new OutboundRoutingPolicy(OutboundRoutingType.Unicast, OutboundRoutingType.Unicast, OutboundRoutingType.Unicast) : new OutboundRoutingPolicy(OutboundRoutingType.Unicast, OutboundRoutingType.Multicast, OutboundRoutingType.Unicast); }
Task DispatchUnicast(IEnumerable <UnicastTransportOperation> operations, TransportTransaction transaction) { return(Task.WhenAll(operations.Select(operation => { PathChecker.ThrowForBadPath(operation.Destination, "message destination"); if (!operation.Message.Headers.TryGetValue(Headers.MessageId, out var messageId)) { messageId = operation.Message.MessageId; } if (!operation.Message.Headers.TryGetValue(Headers.MessageIntent, out var intent)) { intent = "<Unknown>"; } Console.WriteLine($"Sending message {messageId} with intent {intent} sent to {operation.Destination}"); return WriteMessage(operation.Destination, operation, transaction); }))); }
public void Init() { PathChecker.ThrowForBadPath(receiveSettings.ReceiveAddress, "InputQueue"); messagePumpBasePath = Path.Combine(basePath, receiveSettings.ReceiveAddress); bodyDir = Path.Combine(messagePumpBasePath, BodyDirName); delayedDir = Path.Combine(messagePumpBasePath, DelayedDirName); pendingTransactionDir = Path.Combine(messagePumpBasePath, PendingDirName); committedTransactionDir = Path.Combine(messagePumpBasePath, CommittedDirName); if (receiveSettings.PurgeOnStartup) { if (Directory.Exists(messagePumpBasePath)) { Directory.Delete(messagePumpBasePath, true); } } delayedMessagePoller = new DelayedMessagePoller(messagePumpBasePath, delayedDir); }
public LearningTransportInfrastructure(SettingsHolder settings) { this.settings = settings; if (!settings.TryGet(StorageLocationKey, out storagePath)) { var solutionRoot = FindSolutionRoot(); storagePath = Path.Combine(solutionRoot, ".learningtransport"); } settings.SetDefault <MessageProcessingOptimizationExtensions.ConcurrencyLimit>(new MessageProcessingOptimizationExtensions.ConcurrencyLimit { MaxValue = 1 }); var errorQueueAddress = settings.ErrorQueueAddress(); PathChecker.ThrowForBadPath(errorQueueAddress, "ErrorQueueAddress"); settings.Set(Recoverability.DisableLegacyRetriesSatellite, true); }
public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { this.onMessage = onMessage; this.onError = onError; this.criticalError = criticalError; transactionMode = settings.RequiredTransactionMode; PathChecker.ThrowForBadPath(settings.InputQueue, "InputQueue"); messagePumpBasePath = Path.Combine(basePath, settings.InputQueue); bodyDir = Path.Combine(messagePumpBasePath, BodyDirName); delayedDir = Path.Combine(messagePumpBasePath, DelayedDirName); pendingTransactionDir = Path.Combine(messagePumpBasePath, PendingDirName); committedTransactionDir = Path.Combine(messagePumpBasePath, CommittedDirName); purgeOnStartup = settings.PurgeOnStartup; delayedMessagePoller = new DelayedMessagePoller(messagePumpBasePath, delayedDir); return(TaskEx.CompletedTask); }
/// <summary> /// Configures the location where message files are stored. /// </summary> /// <param name="transportExtensions">The transport extensions to extend.</param> /// <param name="path">The storage path.</param> public static void StorageDirectory(this TransportExtensions <TestTransport> transportExtensions, string path) { PathChecker.ThrowForBadPath(path, "StorageDirectory"); transportExtensions.GetSettings().Set(TestTransportInfrastructure.StorageLocationKey, path); }