/// <summary> /// Adds a new interface to the router. /// </summary> /// <typeparam name="T">Transport to use for this interface.</typeparam> /// <param name="name">Name of the interface.</param> /// <param name="customization">A callback for customizing the transport settings.</param> public InterfaceConfiguration <T> AddInterface <T>(string name, Action <TransportExtensions <T> > customization) where T : TransportDefinition, new() { var ifaceConfig = new InterfaceConfiguration <T>(name, customization, this); InterfaceFactories.Add(() => CreateInterface(ifaceConfig)); return(ifaceConfig); }
/// <summary> /// Defines a de-duplicating link with another router. /// </summary> /// <param name="iface">This interface.</param> /// <param name="outgoingInterface">Interface by which the other router is connected.</param> /// <param name="destinationRouter">Address of the other router.</param> /// <param name="connectionFactory">Connection factory to use.</param> /// <param name="epochSize">Size of an epoch.</param> public static void EnableDeduplication(this InterfaceConfiguration <SqlServerTransport> iface, string outgoingInterface, string destinationRouter, Func <SqlConnection> connectionFactory, int epochSize) { var settings = iface.RouterConfiguration.Settings.GetOrCreate <DeduplicationSettings>(); settings.EnableLink(iface.Name, outgoingInterface, destinationRouter, connectionFactory, epochSize); iface.RouterConfiguration.EnableFeature(typeof(DeduplicationFeature)); }
/// <summary> /// Enables message-driven storage-based publish/subscribe for a given interface /// </summary> /// <param name="interfaceConfig">Interface configuration.</param> /// <param name="subscriptionStorage">Subscription storage.</param> public static void EnableMessageDrivenPublishSubscribe <T>(this InterfaceConfiguration <T> interfaceConfig, ISubscriptionStorage subscriptionStorage) where T : TransportDefinition, new() { interfaceConfig.AddRule(c => new ForwardPublishStorageDrivenRule(subscriptionStorage, c.DistributionPolicy)); interfaceConfig.AddRule(c => new ForwardSubscribeMessageDrivenRule(c.Endpoint.TransportAddress, c.Endpoint.EndpointName)); interfaceConfig.AddRule(c => new ForwardUnsubscribeMessageDrivenRule(c.Endpoint.TransportAddress, c.Endpoint.EndpointName)); interfaceConfig.AddRule(c => new StorageDrivenSubscriptionRule(subscriptionStorage)); }
/// <summary> /// Disables native publish/subscribe handling for a given interface. /// </summary> public static void DisableNativePubSub <T>(this InterfaceConfiguration <T> interfaceConfig) where T : TransportDefinition, new() { interfaceConfig.Settings.Set("NativePubSubDisabled", true); }
/// <summary> /// Disables message-driven storage-based publish/subscribe for a given interface. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="interfaceConfig"></param> public static void DisableMessageDrivenPublishSubscribe <T>(this InterfaceConfiguration <T> interfaceConfig) where T : TransportDefinition, new() { interfaceConfig.Settings.Set("EnableMessageDrivenPubSub", false); }
/// <summary> /// Enables message-driven storage-based publish/subscribe for a given interface /// </summary> /// <param name="interfaceConfig">Interface configuration.</param> /// <param name="subscriptionStorage">Subscription storage.</param> public static void EnableMessageDrivenPublishSubscribe <T>(this InterfaceConfiguration <T> interfaceConfig, ISubscriptionStorage subscriptionStorage) where T : TransportDefinition, new() { interfaceConfig.Settings.Set("EnableMessageDrivenPubSub", true); interfaceConfig.Settings.Set <ISubscriptionStorage>(subscriptionStorage); }
Interface CreateInterface <T>(InterfaceConfiguration <T> ifaceConfig) where T : TransportDefinition, new() { return(ifaceConfig.Create(Name, PoisonQueueName, autoCreateQueues, autoCreateQueuesIdentity, ImmediateRetries, DelayedRetries, CircuitBreakerThreshold, typeGenerator, Settings)); }