Пример #1
0
 /// <summary>
 /// Configure the Appication Insights instrumentation key value from
 /// the application's IConfiguration
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="valueSource"></param>
 public static void ApplicationInsightsKeyIs(this JasperSettings settings, Func <IConfiguration, string> valueSource)
 {
     settings.Alter <ApplicationInsightsSettings>((c, s) =>
     {
         s.InstrumentationKey = valueSource(c.Configuration);
     });
 }
Пример #2
0
 /// <summary>
 /// Send all messages published through this application to the Uri
 /// value in configuration with the designated key
 /// </summary>
 /// <param name="configKey">The value of IConfiguration[configKey] to find the Uri</param>
 public void AllMessagesToUriValueInConfig(string configKey)
 {
     _settings.Alter <JasperOptions>((c, options) =>
     {
         var uri = c.Configuration.TryGetUri(configKey);
         options.AddSubscription(Subscription.All(uri));
     });
 }
        /// <summary>
        /// Register Marten backed message persistence based on configuration and the
        /// development environment
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="configure"></param>
        public static void PersistMessagesWithMarten(this JasperSettings settings,
                                                     Action <WebHostBuilderContext, StoreOptions> configure)
        {
            var parent = settings.As <IHasRegistryParent>().Parent;

            if (!parent.AppliedExtensions.OfType <MartenBackedPersistence>().Any())
            {
                parent.Include <MartenBackedPersistence>();
            }

            settings.Alter(configure);
        }
        /// <summary>
        ///     Register Marten backed message persistence to a known connection string
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="connectionString"></param>
        /// <param name="schema"></param>
        public static void PersistMessagesWithMarten(this JasperSettings settings, string connectionString,
                                                     string schema = null)
        {
            var parent = settings.As <IHasRegistryParent>().Parent;

            if (!parent.AppliedExtensions.OfType <MartenBackedPersistence>().Any())
            {
                parent.Include <MartenBackedPersistence>();
            }

            settings.Alter <StoreOptions>(x => { x.Connection(connectionString); });
        }
Пример #5
0
        public void can_alter_settings()
        {
            _settings.Alter <MySettings>(s =>
            {
                s.SomeSetting = 5;
            });

            _settings.Bootstrap();
            var settings = _settings.Get <MySettings>();

            settings.SomeSetting.ShouldBe(5);
        }
        /// <summary>
        /// Register sql server backed message persistence to a known connection string
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="connectionString"></param>
        /// <param name="schema"></param>
        public static void PersistMessagesWithSqlServer(this JasperSettings settings, string connectionString,
                                                        string schema = null)
        {
            var parent = settings.As <IHasRegistryParent>().Parent;

            if (!parent.AppliedExtensions.OfType <SqlServerBackedPersistence>().Any())
            {
                parent.Include <SqlServerBackedPersistence>();
            }

            settings.Alter <SqlServerSettings>(x =>
            {
                x.ConnectionString = connectionString;
                if (schema.IsNotEmpty())
                {
                    x.SchemaName = schema;
                }
            });
        }
 public static void ConfigureMarten(this JasperSettings settings, Action <WebHostBuilderContext, StoreOptions> configuration)
 {
     settings.Alter <StoreOptions>(configuration);
 }
 public static void ConfigureMarten(this JasperSettings settings, Action <StoreOptions> configuration)
 {
     settings.Alter(configuration);
 }
 public static void MartenConnectionStringIs(this JasperSettings settings, string connectionString)
 {
     settings.Alter <StoreOptions>(x => x.Connection(connectionString));
 }
        public static void AddRabbitMqHost(this JasperSettings settings, string host, int port = 5672)
        {
            var connectionString = $"host={host};port={port}";

            settings.Alter <RabbitMqOptions>(s => s.Connections.Add(host, connectionString));
        }
Пример #11
0
 /// <summary>
 /// Configure the options for the Azure Service Bus transport
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="alteration"></param>
 public static void ConfigureAzureServiceBus(this JasperSettings settings, Action <AzureServiceBusOptions> alteration)
 {
     settings.Alter(alteration);
 }
 /// <summary>
 /// Register configuration of the Rabbit MQ transport
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="configure"></param>
 public static void ConfigureRabbitMq(this JasperSettings settings, Action <RabbitMqOptions> configure)
 {
     settings.Alter(configure);
 }
 public static void AddRabbitMqConnection(this JasperSettings settings, string connectionName, string connectionString)
 {
     settings.Alter <RabbitMqOptions>(s => s.Connections.Add(connectionName, connectionString));
 }
Пример #14
0
 /// <summary>
 /// Configure the options for the Azure Service Bus transport using the system's IConfiguration and IHostingEnvironment
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="alteration"></param>
 public static void ConfigureAzureServiceBus(this JasperSettings settings, Action <AzureServiceBusOptions, IHostingEnvironment, IConfiguration> alteration)
 {
     settings.Alter <AzureServiceBusOptions>((context, x) => alteration(x, context.HostingEnvironment, context.Configuration));
 }
Пример #15
0
 /// <summary>
 /// If you already know your ApplicationInsights InstrumentationKey, use
 /// this to set it for the Jasper integration
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="instrumentationKey"></param>
 public static void ApplicationInsightsKeyIs(this JasperSettings settings, string instrumentationKey)
 {
     settings.Alter <ApplicationInsightsSettings>(x => x.InstrumentationKey = instrumentationKey);
 }
 /// <summary>
 /// Register configuration of the Rabbit MQ transport
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="configure"></param>
 public static void ConfigureRabbitMq(this JasperSettings settings, Action <RabbitMqOptions, IHostingEnvironment, IConfiguration> configure)
 {
     settings.Alter <RabbitMqOptions>((context, x) => configure(x, context.HostingEnvironment, context.Configuration));
 }
Пример #17
0
 /// <summary>
 /// Add a new, named Azure Service Bus connection to the application
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="name"></param>
 /// <param name="connectionString"></param>
 public static void AddAzureServiceBusConnection(this JasperSettings settings, string name,
                                                 string connectionString)
 {
     settings.Alter <AzureServiceBusOptions>(s => s.Connections.Add(name, connectionString));
 }