public static void ConfigureInfra(this ITnfConfiguration tnfConfiguration)
 {
     tnfConfiguration.Repository(config =>
     {
         config.Entity <PurchaseOrderPoco>(entity => entity.RequestDto <DefaultRequestDto>((e, d) => e.Id == d.Id));
     });
 }
Ejemplo n.º 2
0
 public static void ConfigureStockMessaging(this ITnfConfiguration tnfConfiguration, IConfiguration configuration)
 {
     ConfigurePublishedEvents(tnfConfiguration, configuration);
     ConfigurePubleshedCommands(tnfConfiguration, configuration);
     ConfigureListeningCommands(tnfConfiguration, configuration);
     ConfigureListeningEvents(tnfConfiguration, configuration);
 }
Ejemplo n.º 3
0
        public static ITnfConfiguration UseZeroLocalization(this ITnfConfiguration configuration)
        {
            configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));

            // Set the localization file for the solution errors
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(AppConsts.LocalizationSourceName,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(
                                                          typeof(DomainServiceCollectionExtensions).Assembly,
                                                          "Tnf.Zero.Domain.Localization.SourceFiles"
                                                          )
                                                      )
                );

            // Set the localization file for the Tnf errors
            configuration.Localization.ReplaceTnfLocalizationSource(
                new JsonEmbeddedFileLocalizationDictionaryProvider(
                    typeof(DomainServiceCollectionExtensions).Assembly,
                    "Tnf.Zero.Domain.Localization.TnfSourceFiles"
                    )
                );

            return(configuration);
        }
Ejemplo n.º 4
0
        public static void UseDomainLocalization(this ITnfConfiguration configuration)
        {
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(AppConsts.LocalizationSourceName,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(
                                                          typeof(LocalizationExtensions).Assembly,
                                                          "Poll.Domain.Localization.SourceFiles")));

            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));
        }
Ejemplo n.º 5
0
        public static void AddDomainLocalization(this ITnfConfiguration configuration)
        {
            // Incluindo o source de localização
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(Case4Consts.LocalizationSourceName,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(typeof(Case4Consts).Assembly, "Case4.Domain.Localization.SourceFiles")));

            // Incluindo suporte as seguintes linguagens
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));
            configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));
        }
Ejemplo n.º 6
0
        private static void ConfigureListeningCommands(ITnfConfiguration tnfConfiguration, IConfiguration configuration)
        {
            var makeProductReservationCommand = TopicSetup.Builder
                                                .New(s =>
                                                     s.Message <MakeProductReservationCommand>()
                                                     .AddKey(nameof(MakeProductReservationCommand)));

            var cancelProductReservationsCommand = TopicSetup.Builder
                                                   .New(s =>
                                                        s.Message <CancelProductReservationsCommand>()
                                                        .AddKey(nameof(CancelProductReservationsCommand)));

            // Cria uma Fila
            var queue = QueueSetup.Builder
                        .New(s => s
                             .QueueName("Stock.Commands.Queue")
                             .AddTopics(makeProductReservationCommand)
                             .AddTopics(cancelProductReservationsCommand)
                             .Reliability(r => r
                                          .AutoAck(false)
                                          .AutoDeleteQueue(false)
                                          .MaxMessageSize(256)
                                          .PersistMessage(true))
                             .QoS(q => q
                                  .PrefetchGlobalLimit(true)
                                  .PrefetchLimit(100)
                                  .PrefetchSize(0)));

            var eventExchangeRouter = ExchangeRouter
                                      .Builder
                                      .Factory()
                                      .Name("Stock.Commands.Exchange")
                                      .AddQueue(queue)
                                      .ServerAddress(configuration["RabbitMqHost"])
                                      .Type(ExchangeType.direct)
                                      .QueueChannel(QueueChannel.Amqp)
                                      .Reliability(isDurable: true, isAutoDelete: false, isPersistent: true)
                                      .SetExclusive(false)
                                      .AutomaticRecovery(
                isEnable: true,
                connectionTimeout: 15000,
                networkRecoveryInterval: TimeSpan.FromSeconds(10))
                                      .MessageCollector(
                refreshInterval: TimeSpan.FromMilliseconds(value: 2000),
                timeout: TimeSpan.FromSeconds(60))
                                      .ShutdownBehavior(
                graceful: new CancellationTokenSource(),
                forced: new CancellationTokenSource())
                                      .Build();

            tnfConfiguration
            .BusClient()
            .AddSubscriber(e => eventExchangeRouter, e => new SubscriberListener(e, tnfConfiguration.ServiceProvider));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Configures localization for the application
        /// </summary>
        public static ITnfConfiguration ConfigureApplicationLocalization(this ITnfConfiguration configuration)
        {
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));

            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(LocalizationSources.Application,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(
                                                          typeof(ApplicationServiceCollectionExtensions).Assembly,
                                                          "App.CheckIn.Notifier.Application.Localization.SourceFiles"
                                                          )
                                                      )
                );

            return(configuration);
        }
Ejemplo n.º 8
0
        public static ITnfConfiguration ConfigureFiscalDomain(this ITnfConfiguration configuration)
        {
            // Incluindo o source de localização
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(Constants.LocalizationSourceName,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(
                                                          typeof(Constants).Assembly,
                                                          "SuperMarket.FiscalService.Domain.Localization.SourceFiles")));

            // Incluindo suporte as seguintes linguagens
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));
            configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));

            return(configuration);
        }
        public static void AddInfraLocalization(this ITnfConfiguration configuration)
        {
            // Incluindo suporte as seguintes linguagens
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português (Brasil)", isDefault: true));
            configuration.Localization.Languages.Add(new LanguageInfo("en", "Inglês"));

            // Configura qual o source de localização da aplicação
            // Mesmo habilitando a localização via banco de dados é necessário definir um source
            // de localização fisico que irá funcionar como fallback se a key informada não for encontrada
            // no banco de dados
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    InfraConsts.LocalizationSourceName,
                    new JsonEmbeddedFileLocalizationDictionaryProvider(typeof(InfraConsts).Assembly, "Case5.Infra.Localization.JsonSources")));
        }
Ejemplo n.º 10
0
        public static ITnfConfiguration ConfigureCrudDomain(this ITnfConfiguration configuration)
        {
            // Incluindo o source de localização
            configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(Constants.LocalizationSourceName,
                                                      new JsonEmbeddedFileLocalizationDictionaryProvider(
                                                          typeof(Constants).Assembly,
                                                          "SuperMarket.Backoffice.Crud.Domain.Localization.SourceFiles")));

            // Incluindo suporte as seguintes linguagens
            configuration.Localization.Languages.Add(new LanguageInfo("pt-BR", "Português", isDefault: true));
            configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));

            configuration.Repository(repository =>
            {
                repository.Entity <IEntity>(entity => entity.RequestDto <IDefaultRequestDto>((e, d) => e.Id == d.Id));
            });

            return(configuration);
        }
Ejemplo n.º 11
0
 public DapperSqlServerProvider(ITnfConfiguration tnfConfiguration, DapperOptions dapperOptions, IActiveTransactionProvider activeTransactionProvider)
 {
     _tnfConfiguration          = tnfConfiguration;
     _dapperOptions             = dapperOptions;
     _activeTransactionProvider = activeTransactionProvider;
 }
Ejemplo n.º 12
0
 public DapperPostgreProvider(ITnfConfiguration tnfConfiguration, IActiveTransactionProvider activeTransactionProvider)
 {
     _tnfConfiguration          = tnfConfiguration;
     _activeTransactionProvider = activeTransactionProvider;
 }
Ejemplo n.º 13
0
        public static ITnfConfiguration ConfigureFiscalServiceQueueInfraDependency(this ITnfConfiguration configuration)
        {
            // Cria um Tópico da mensagem PurchaseOrderChangedMessage
            var purchaseOrderChangedTopicToSubscribe = TopicSetup.Builder
                                                       .New(s =>
                                                            s.Message <PurchaseOrderChangedMessage>()
                                                            .AddKey("PurchaseOrder.Changed.Message"));

            var purchaseOrderQueueToSubscribe = QueueSetup.Builder
                                                .New(s => s
                                                     .QueueName("PurchaseOrderQueue")
                                                     .Reliability(r => r
                                                                  .AutoAck(false)
                                                                  .AutoDeleteQueue(true)
                                                                  .MaxMessageSize(256)
                                                                  .PersistMessage(false))
                                                     .QoS(q => q
                                                          .PrefetchGlobalLimit(true)
                                                          .PrefetchLimit(100)
                                                          .PrefetchSize(0))
                                                     .AddTopics(purchaseOrderChangedTopicToSubscribe));

            // Cria um Tópico da mensagem TaxMovimentCalculatedMessage
            var taxMovimentCalculatedTopicToPublish = TopicSetup.Builder
                                                      .New(s =>
                                                           s.Message <TaxMovimentCalculatedMessage>()
                                                           .AddKey("TaxMoviment.Calculated.Message"));

            var taxMovimentQueueToPublish = QueueSetup.Builder
                                            .New(s => s
                                                 .QueueName("TaxMovimentQueue")
                                                 .Reliability(r => r
                                                              .AutoAck(false)
                                                              .AutoDeleteQueue(true)
                                                              .MaxMessageSize(256)
                                                              .PersistMessage(false))
                                                 .QoS(q => q
                                                      .PrefetchGlobalLimit(true)
                                                      .PrefetchLimit(100)
                                                      .PrefetchSize(0))
                                                 .AddTopics(taxMovimentCalculatedTopicToPublish));

            // Cria um Exchange Router
            var exchangeRouterToPublish = ExchangeRouter
                                          .Builder
                                          .Factory()
                                          .Name("SuperMarket")
                                          .ServerAddress("127.0.0.1")
                                          .Type(ExchangeType.topic)
                                          .QueueChannel(QueueChannel.Amqp)
                                          .Reliability(isDurable: false, isAutoDelete: false, isPersistent: false)
                                          .AddQueue(taxMovimentQueueToPublish)
                                          .SetExclusive(false)
                                          .AutomaticRecovery(
                isEnable: true,
                connectionTimeout: 15000,
                networkRecoveryInterval: TimeSpan.FromSeconds(10))
                                          .MessageCollector(
                refreshInterval: TimeSpan.FromMilliseconds(value: 2000),
                timeout: TimeSpan.FromSeconds(60))
                                          .ShutdownBehavior(
                graceful: new CancellationTokenSource(),
                forced: new CancellationTokenSource())
                                          .Build();

            var exchangeRouterToSubscribe = ExchangeRouter
                                            .Builder
                                            .Factory()
                                            .Name("SuperMarket")
                                            .ServerAddress("127.0.0.1")
                                            .Type(ExchangeType.topic)
                                            .QueueChannel(QueueChannel.Amqp)
                                            .Reliability(isDurable: false, isAutoDelete: false, isPersistent: false)
                                            .AddQueue(purchaseOrderQueueToSubscribe)
                                            .SetExclusive(false)
                                            .AutomaticRecovery(
                isEnable: true,
                connectionTimeout: 15000,
                networkRecoveryInterval: TimeSpan.FromSeconds(10))
                                            .MessageCollector(
                refreshInterval: TimeSpan.FromMilliseconds(value: 2000),
                timeout: TimeSpan.FromSeconds(60))
                                            .ShutdownBehavior(
                graceful: new CancellationTokenSource(),
                forced: new CancellationTokenSource())
                                            .Build();

            // Configura para que ela publique mensagens
            configuration
            .BusClient()
            .AddPublisher(
                exBuilder: e => exchangeRouterToPublish,
                listener: er => new PublisherListener(
                    exchangeRouter: er,
                    serviceProvider: configuration.ServiceProvider))
            .AddSubscriber(
                exBuilder: e => exchangeRouterToSubscribe,
                listener: er => new SubscriberListener(
                    exchangeRouter: er,
                    serviceProvider: configuration.ServiceProvider),
                poolSize: 4);

            return(configuration);
        }
Ejemplo n.º 14
0
 private static void ConfigureListeningEvents(ITnfConfiguration tnfConfiguration, IConfiguration configuration)
 {
 }
Ejemplo n.º 15
0
 private static void ConfigurePubleshedCommands(ITnfConfiguration tnfConfiguration, IConfiguration configuration)
 {
 }
Ejemplo n.º 16
0
 public TnfDbProviderFactory(ITnfConfiguration tnfConfiguration)
 {
     this.tnfConfiguration = tnfConfiguration;
 }