Example #1
0
        public void Configure(JasperOptionsBuilder registry)
        {
            registry.Services.AddSingleton <MessageHistory>();


            registry.Services.For <IMessageLogger>().Use <MessageTrackingLogger>().Singleton();
        }
Example #2
0
        internal async Task <HandlerCall[]> FindCalls(JasperOptionsBuilder registry)
        {
            if (_conventionalDiscoveryDisabled)
            {
                return(_explicitTypes.SelectMany(actionsFromType).ToArray());
            }

            if (registry.ApplicationAssembly == null)
            {
                return(new HandlerCall[0]);
            }


            // TODO -- need to expose the module assemblies off of this

            var types = await TypeRepository.FindTypes(registry.ApplicationAssembly,
                                                       TypeClassification.Concretes | TypeClassification.Closed, type => _typeFilters.Matches(type))
                        .ConfigureAwait(false);


            return(types
                   .Where(x => !x.HasAttribute <JasperIgnoreAttribute>())
                   .Concat(_explicitTypes)
                   .Distinct()
                   .SelectMany(actionsFromType).ToArray());
        }
Example #3
0
        public static Assembly DetermineApplicationAssembly(JasperOptionsBuilder registry)
        {
            var assembly  = registry.GetType().Assembly;
            var isFeature = assembly.GetCustomAttribute <JasperFeatureAttribute>() != null;

            if (!Equals(assembly, typeof(JasperRegistry).Assembly) && !isFeature)
            {
                return(assembly);
            }
            return(Find());
        }
Example #4
0
        public void Configure(JasperOptionsBuilder registry)
        {
            // Add service registrations
            registry.Services.AddTransient <IFoo, Foo>();

            // Alter settings within the application
            registry.Settings.Alter <JasperOptions>(_ =>
            {
                _.JsonSerialization.TypeNameHandling = TypeNameHandling.All;
            });
        }
Example #5
0
        public void Configure(JasperOptionsBuilder registry)
        {
            Registry = registry;

            registry.Settings.Alter <ModuleSettings>(_ =>
            {
                _.From  = "Module1";
                _.Count = 100;
            });

            registry.Services.For <IModuleService>().Use <ServiceFromModule>();
        }
        internal void StartCompiling(JasperOptionsBuilder registry)
        {
            Compiling = Handling.Source.FindCalls(registry).ContinueWith(t =>
            {
                var calls = t.Result;

                if (calls != null && calls.Any())
                {
                    Graph.AddRange(calls);
                }

                Graph.Group();
                Handling.ApplyPolicies(Graph, registry.CodeGeneration);
            });
        }
Example #7
0
        public void Configure(JasperOptionsBuilder registry)
        {
            registry.Settings.Require <ApplicationInsightsSettings>();

            registry.Services.AddSingleton <IMetrics, ApplicationInsightsMetrics>();
            registry.Services.AddSingleton(s =>
            {
                var config = s.GetService <ApplicationInsightsSettings>();
                var client = new TelemetryClient {
                    InstrumentationKey = config.InstrumentationKey
                };


                return(client);
            });
        }
Example #8
0
        public void Configure(JasperOptionsBuilder registry)
        {
            registry.Services.AddSingleton <IDocumentStore>(x =>
            {
                var storeOptions  = x.GetService <StoreOptions>();
                var documentStore = new DocumentStore(storeOptions);
                return(documentStore);
            });

            registry.Handlers.GlobalPolicy <FineGrainedSessionCreationPolicy>();


            registry.Services.AddScoped(c => c.GetService <IDocumentStore>().OpenSession());
            registry.Services.AddScoped(c => c.GetService <IDocumentStore>().QuerySession());

            registry.CodeGeneration.Sources.Add(new SessionVariableSource());
        }
Example #9
0
        public void Configure(JasperOptionsBuilder registry)
        {
            registry.Settings.Require <SqlServerSettings>();

            registry.Services.AddSingleton <IDurableMessagingFactory, SqlServerBackedDurableMessagingFactory>();
            registry.Services.AddTransient <IEnvelopePersistor, SqlServerEnvelopePersistor>();

            registry.Services.AddSingleton <IHostedService, SchedulingAgent>();

            registry.CodeGeneration.Sources.Add(new SqlServerBackedPersistenceMarker());


            registry.Services.For <SqlConnection>().Use <SqlConnection>();

            registry.Services.Add(new SqlConnectionInstance(typeof(SqlConnection)));
            registry.Services.Add(new SqlConnectionInstance(typeof(DbConnection)));

            registry.CodeGeneration.Transactions = new SqlServerTransactionFrameProvider();
        }
        public void Configure(JasperOptionsBuilder registry)
        {
            registry.Services.AddTransient <IEnvelopePersistor, MartenEnvelopePersistor>();
            registry.Services.AddSingleton <IDurableMessagingFactory, MartenBackedDurableMessagingFactory>();
            registry.Settings.Alter <StoreOptions>(options =>
            {
                options.Storage.Add <PostgresqlEnvelopeStorage>();
                options.Schema.For <ErrorReport>().Duplicate(x => x.MessageType).Duplicate(x => x.ExceptionType);
            });

            registry.Services.AddSingleton <IHostedService, SchedulingAgent>();

            registry.CodeGeneration.Sources.Add(new MartenBackedPersistenceMarker());

            var frameProvider = new MartenSagaPersistenceFrameProvider();

            registry.CodeGeneration.SagaPersistence = frameProvider;
            registry.CodeGeneration.Transactions    = frameProvider;
        }
Example #11
0
 public JasperSettings(JasperOptionsBuilder parent)
 {
     _parent = parent;
 }
Example #12
0
 public void Configure(JasperOptionsBuilder registry)
 {
     registry.Handlers.IncludeType <ExtensionThing>();
 }
Example #13
0
 public void Configure(JasperOptionsBuilder registry)
 {
     // apply alterations
 }
 public void Configure(JasperOptionsBuilder registry)
 {
     registry.Services.For <IColorService>().Use <RedService>();
 }
 public void Configure(JasperOptionsBuilder registry)
 {
     registry.Settings.Require <RabbitMqSettings>();
     registry.Services.AddTransient <ITransport, RabbitMqTransport>();
 }