public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (ProcessableWithInterfaceAttribute)attribute;
            var interfaceType  = attributeTyped.GetInterfaceOrDefault(typeWithAttribute);

            D.R.InstantiatePerScope(interfaceType, typeWithAttribute, false);
        }
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (IntegrationEventHandlerAttribute)attribute;

            var eventHandlerRegistry = D.P.GetRequiredInstance <IIntegrationEventHandlerRegistry>();

            eventHandlerRegistry.Add(attributeTyped.EventStreamIdentifier, typeWithAttribute);
        }
Example #3
0
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var interfaceType = ((ProcessableWithInterfaceAttribute)attribute).GetInterfaceOrDefault(typeWithAttribute);

            var instance = (ISomeConfigurable)D.P.GetRequiredInstance(interfaceType);

            instance.Configured = true;
        }
Example #4
0
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var key = ((OutboxProcessorAttribute)attribute).ScheduleConfigurationKey;
            var scheduleConfiguration = D.O.GetRequiredString(key);
            var outboxProcessor       = D.P.GetRequiredInstance <IOutboxProcessor>();

            outboxProcessor.Schedule(scheduleConfiguration);
        }
Example #5
0
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var boundedContext  = ((OutboxAttribute)attribute).BoundedContext;
            var outboxProcessor = D.P.GetRequiredInstance <IOutboxProcessor>();

            GenericsHelper.RegisterOutboxToOutboxProcessor(outboxProcessor, typeWithAttribute, boundedContext,
                                                           OutboxPublicationType);
        }
        public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (MultiInstantiateAttribute)attribute;
            var interfaceType  = attributeTyped.GetInterfaceOrDefault(typeWithAttribute);

            D.M.Add(interfaceType, attributeTyped.ImplementationKey, typeWithAttribute);

            D.R.InstantiatePerInjection(typeWithAttribute, false);
        }
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (MessageForExchangeCommandQueueTargetAttribute)attribute;

            var messageBus          = D.P.GetRequiredInstance <IMessageBus>();
            var messageListenerType = attributeTyped.MessageListenerType;

            var targetBoundedContext = attributeTyped.TargetBoundedContext;
            var exchangeName         = Exchange.CommandsFor(targetBoundedContext);
            var queueName            = Queue.For(targetBoundedContext);

            GenericsHelper.RegisterMessageToMessageBus(messageBus, typeWithAttribute, messageListenerType, exchangeName, queueName);
        }
Example #8
0
        private void ConfigureType(IConfigurationContext context, Type type, ProcessableAttribute attribute)
        {
            var attributeType = attribute.GetType();
            var extension     = GetExtensionForAttribute(attributeType);

            if (extension == null)
            {
                throw new InvalidOperationException($"Unhandled attribute '{attributeType.Name}'");
            }

            extension.Configure(context, attribute, type);

            Options.Logger?.Log($"Configured class '{type.Name}' with attribute '{attributeType.Name}'");
        }
        public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (BoundedContextAttribute)attribute;

            var connectionStringConfigurationKey = attributeTyped.ConnectionStringConfigurationKey;
            var connectionString             = D.O.GetRequiredString(connectionStringConfigurationKey);
            var migrationsHistoryTable       = attributeTyped.MigrationsHistoryTable;
            var migrationsHistoryTableSchema = attributeTyped.MigrationsHistoryTableSchema;
            var retryCount        = attributeTyped.RetryCount;
            var retryDelaySeconds = attributeTyped.RetryDelaySeconds;

            S.R.AddDatabaseContext(typeWithAttribute, connectionString, migrationsHistoryTable, migrationsHistoryTableSchema,
                                   retryCount, retryDelaySeconds);
        }
Example #10
0
        public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var attributeTyped = (ExternalServiceAttribute)attribute;

            var interfaceType = attributeTyped.GetInterfaceOrDefault(typeWithAttribute);
            var baseAddressConfigurationKey = attributeTyped.BaseAddressConfigurationKey;
            var baseAddress                   = D.O.GetRequiredString(baseAddressConfigurationKey);
            var retryCount                    = attributeTyped.RetryCount;
            var retryDelayMilliseconds        = attributeTyped.RetryDelayMilliseconds;
            var circuitBreakerEventCount      = attributeTyped.CircuitBreakerEventCount;
            var circuitBreakerDurationSeconds = attributeTyped.CircuitBreakerDurationSeconds;

            S.R.AddExternalService(interfaceType, typeWithAttribute, baseAddress, retryCount, retryDelayMilliseconds,
                                   circuitBreakerEventCount, circuitBreakerDurationSeconds);
        }
Example #11
0
        private void RegisterType(IRegistrationContext context, Type type, ProcessableAttribute attribute)
        {
            var attributeType = attribute.GetType();

            var extension = GetExtensionForAttribute(attributeType);

            if (extension == null)
            {
                throw new InvalidOperationException($"Unhandled attribute '{attributeType.Name}'");
            }

            if (extension.BaseInterfaceOfTypeWithAttribute != null)
            {
                type.EnsureDerivesFromInterfaceOrGenericInterfaceWithUntypedParameter(extension.BaseInterfaceOfTypeWithAttribute);
            }

            extension.Register(context, attribute, type);

            Statistics.RegisteredClasses++;

            Options.Logger?.Log($"Registered class '{type.Name}' with attribute '{attributeType.Name}'");
        }
 public abstract void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute);
 public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
     D.R.InstantiatePerContainer(typeof(IMessageBus), typeWithAttribute, false);
 }
Example #14
0
        public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            // The registration is performed without an interface because each type of outbox has to be registered.

            D.R.InstantiatePerScope(typeWithAttribute, false);
        }
 public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
     D.R.InstantiatePerContainer(BaseInterfaceOfTypeWithAttribute !, typeWithAttribute, false);
 }
Example #16
0
        public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
        {
            var commandHandlerRegistry = D.P.GetRequiredInstance <ICommandHandlerRegistry>();

            commandHandlerRegistry.Add(typeWithAttribute);
        }
 public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
 }
Example #18
0
 public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
     D.R.InstantiatePerInjection(typeWithAttribute, false);
 }
 public abstract void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute);
Example #20
0
 public override void Configure(IConfigurationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
 }
Example #21
0
 public override void Register(IRegistrationContext context, ProcessableAttribute attribute, Type typeWithAttribute)
 {
     S.R.AddHostedService(typeWithAttribute);
 }