public EventHubProducerSpecification(IEventHubHostConfiguration hostConfiguration, IHostSettings hostSettings)
 {
     _hostConfiguration          = hostConfiguration;
     _hostSettings               = hostSettings;
     _serializationConfiguration = new SerializationConfiguration();
     _sendObservers              = new SendObservable();
 }
Example #2
0
 static Startup()
 {
     _container = new WindsorContainer()
                  // app.config first, so we can override registrations if we want/have to
                  .Install(WConfiguration.FromAppConfig(), FromAssembly.This());
     _hostSettings = _container.Resolve <IHostSettings>();
 }
Example #3
0
 public TcpStreamBroadcaster(IHostSettings settings, IHostGlobalEvents globalEvents, ILogger logger)
 {
     this.globalEvents = globalEvents;
     this.logger = logger;
     localaddr = IPAddress.Parse(settings.TcpHostName);
     port = settings.TcpPort;
     activeClients = new ConcurrentHashSet<TcpStreamBroadcasterClientProcessor>();
 }
Example #4
0
 public EventHubConnectionContext(IHostSettings hostSettings, IStorageSettings storageSettings, Action <EventHubProducerClientOptions> configureOptions,
                                  CancellationToken cancellationToken)
     : base(cancellationToken)
 {
     _configureOptions = configureOptions;
     HostSettings      = hostSettings;
     StorageSettings   = storageSettings;
 }
 public ServersController(
     IServerQueries serverQueries,
     IServerCommands serverCommands,
     IHostSettings hostSettings)
 {
     _serverQueries  = serverQueries;
     _serverCommands = serverCommands;
     _hostSettings   = hostSettings;
 }
Example #6
0
        public EventHubReceiveEndpointSpecification(string eventHubName, string consumerGroup, IHostSettings hostSettings, IStorageSettings storageSettings,
                                                    Action <IEventHubReceiveEndpointConfigurator> configure)
        {
            _consumerGroup   = consumerGroup;
            _hostSettings    = hostSettings;
            _storageSettings = storageSettings;
            _configure       = configure;
            Name             = eventHubName;

            _endpointObservers = new ReceiveEndpointObservable();
        }
 public EventHubProducerSharedContext(IBusInstance busInstance, SendObservable sendObservers, ISendPipe sendPipe,
                                      ISerializationConfiguration serializationConfiguration, IHostSettings hostSettings, EventHubProducerClientOptions options)
 {
     SendObservers = sendObservers;
     SendPipe      = sendPipe;
     _busInstance  = busInstance;
     _serializationConfiguration = serializationConfiguration;
     _hostSettings = hostSettings;
     _options      = options;
     _clients      = new ConcurrentDictionary <string, EventHubProducerClient>();
 }
Example #8
0
 public SMHostSettings(IHostSettings value)
 {
     this.Id = value.Id;
     this.DataSource = value.DataSource;
     this.DatabaseName = value.DatabaseName;
     this.UserLogin = value.UserLogin;
     this.Password = value.Password;
     this.SALogin = value.SALogin;
     this.SAPassword = value.SAPassword;
     this.BaseKey = value.BaseKey;
 }
Example #9
0
        public RpcClientServer(ITopologyLoader topologyLoader, TimeoutSettings defaultTimeout, ISettingsLoader settingsLoader, RpcComponentOverrides componentOverrides = null)
        {
            topology            = topologyLoader.Load();
            this.defaultTimeout = defaultTimeout;
            settings            = settingsLoader.LoadHostSettings();
            var componentContainer = new RpcClientServerComponentContainer(this, componentOverrides ?? new RpcComponentOverrides());

            logger = componentContainer.GetLogger();
            serviceImplementationContainer = componentContainer.GetServiceImplementationContainer();
            requestReceiver       = componentContainer.GetRequestReceiverContainer().GetReceiver(settings.EndPoint.Protocol);
            serviceProxyContainer = componentContainer.GetIServiceProxyContainer();
        }
Example #10
0
        public EventHubReceiveEndpointSpecification(IEventHubHostConfiguration hostConfiguration, string eventHubName, string consumerGroup,
                                                    IHostSettings hostSettings, IStorageSettings storageSettings,
                                                    Action <IEventHubReceiveEndpointConfigurator> configure)
        {
            _hostConfiguration = hostConfiguration;
            _eventHubName      = eventHubName;
            _consumerGroup     = consumerGroup;
            _hostSettings      = hostSettings;
            _storageSettings   = storageSettings;
            _configure         = configure;
            EndpointName       = $"{EventHubEndpointAddress.PathPrefix}/{_eventHubName}";

            _endpointObservers = new ReceiveEndpointObservable();
        }
Example #11
0
        public MessageBrokerShould()
        {
            hostSettings = new ProviderHostSettings(kafkaHost);
            processor    = new Processor();

            var loggerMock = new Mock <IMessageLogger>();

            loggerMock.Setup(x => x.LogMessage(It.IsAny <EventId>(), It.IsAny <IProcessor>(), It.IsAny <ILogMessage>()));
            this.messageLogger = loggerMock.Object;

            testMessages     = TestMessages.GenerateMessages(4);
            receivedMessages = new List <TestMessage>();
            maxMessagesToReadInSingleListener = testMessages.Count;
        }
Example #12
0
        public Announcer(IHostSettings hostSettings, IProcessor processor, IMessageLogger messageLogger)
        {
            _hostSettings  = hostSettings;
            _processor     = processor;
            _messageLogger = messageLogger;

            var config = new Dictionary <string, object> {
                //No't expect many brokers, so config contains only one.
                { "bootstrap.servers", _hostSettings.HostSettings["server"] },
                { "acks", _hostSettings.HostSettings["acks"] },
            };

            producer          = new Producer <string, string>(config, new StringSerializer(Encoding.UTF8), new StringSerializer(Encoding.UTF8));
            producer.OnError += Producer_OnError;
        }
        public EventHubReceiveEndpointConfigurator(string eventHubName, string consumerGroup, IHostSettings hostSettings, IStorageSettings storageSettings,
                                                   IBusInstance busInstance,
                                                   IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _eventHubName          = eventHubName;
            _consumerGroup         = consumerGroup;
            _hostSettings          = hostSettings;
            _storageSettings       = storageSettings;
            _busInstance           = busInstance;
            _endpointConfiguration = endpointConfiguration;

            CheckpointInterval     = TimeSpan.FromMinutes(1);
            CheckpointMessageCount = 5000;
            ConcurrencyLimit       = 1;
        }
Example #14
0
        /// <summary>
        ///  Instancie un nouvel objet SqlWorker
        /// </summary>
        /// <param name="settings">Configuration de connexion au serveur de base de données</param>
        public SqlWorker(IHostSettings settings)
        {
            var builder = new SqlConnectionStringBuilder()
            {
                DataSource = settings.Server,
                UserID = settings.User,
                Password = settings.Password,
                IntegratedSecurity = false,
                MultipleActiveResultSets = true
            };

            if (!string.IsNullOrEmpty(settings.Database))
                builder.InitialCatalog = settings.Database;

            InitConnection = () => { return new SqlConnection(builder.ConnectionString); };
        }
Example #15
0
        public Listener(IHostSettings hostSettings, IProcessor processor, IMessageLogger messageLogger)
        {
            _hostSettings  = hostSettings;
            _processor     = processor;
            _messageLogger = messageLogger;


            var config = new Dictionary <string, object> {
                //No't expect many brokers, so config contains only one.
                { "bootstrap.servers", _hostSettings.HostSettings["server"] },
                { "group.id", _hostSettings.HostSettings["group.id"] },
                { "enable.auto.commit", _hostSettings.HostSettings["enable.auto.commit"] == "false" ? false: true },
                //Protect loosing messages in kafka queue.
                //What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted):
                //earliest: automatically reset the offset to the earliest offset
                //https://stackoverflow.com/questions/41875288/kafka-lost-messages
                { "auto.offset.reset", _hostSettings.HostSettings["auto.offset.reset"] },
            };

            this.consumer                 = new Consumer <string, string>(config, new StringDeserializer(Encoding.UTF8), new StringDeserializer(Encoding.UTF8));
            this.consumer.OnMessage      += Consumer_OnMessage;
            this.consumer.OnError        += Consumer_OnError;
            this.consumer.OnConsumeError += Consumer_OnConsumeError;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="KnifeStoreLogic"/> class.
 /// Initialize the components which are needed.
 /// </summary>
 /// <param name="editorService">Editor service component.</param>
 /// <param name="messengerService">Messenger service component.</param>
 public KnifeStoreLogic(IEditorService editorService, IMessenger messengerService, IHostSettings hostSettings)
 {
     this.editorService    = editorService;
     this.messengerService = messengerService;
     this.hostSettings     = hostSettings;
 }
Example #17
0
 public HolidayConfigurationSnapshot(IHostSettings hostSettings)
 {
     this.hostSettings = hostSettings;
 }
Example #18
0
 public AnnouncerShould()
 {
     hostSettings    = new ProviderHostSettings(kafkaHost);
     messageSettings = new MessageSettingsOut(produceOnTopic);
     processor       = new Processor();
 }
Example #19
0
        public int SaveHostSettings(IHostSettings hostSettings)
        {
            try {
                int result = -1;
                string sql;
                using (DbConnection = new SQLitePersistence(DbConnectionSettings)) {
                    if (DbConnection.IsConnected()) {
                        using (DbCommand = new SQLiteCommand()) {
                            DbCommand.Parameters.Clear();
                            if (hostSettings.Id <= 0) {
                                sql =
                                     "INSERT INTO HostSettings " +
                                     "(datasource, databasename, userlogin, password, salogin, sapassword,basekey) " +
                                     "Values(@DataSource,@DatabaseName,@UserLogin, @Password, @SaLogin, @SaPassword, @BaseKey);";

                                DbCommand.Parameters.AddWithValue("@BaseKey", Security.GetSha2Hash(hostSettings.BaseKey, Crc32.Compute(hostSettings.BaseKey).ToString()));
                            }else {
                                sql =
                                     "UPDATE HostSettings " +
                                     "SET datasource = @DataSource, databasename = @DatabaseName, userlogin = @UserLogin, password = @Password, salogin = @SaLogin, sapassword = @SaPassword " +
                                     "WHERE id = @ID";
                                DbCommand.Parameters.AddWithValue("@ID", hostSettings.Id);
                            }
                            DbCommand.CommandText = sql;
                            DbCommand.Parameters.AddWithValue("@DataSource", hostSettings.DataSource);
                            DbCommand.Parameters.AddWithValue("@DatabaseName", hostSettings.DatabaseName);
                            DbCommand.Parameters.AddWithValue("@UserLogin", hostSettings.UserLogin);
                            DbCommand.Parameters.AddWithValue("@Password", hostSettings.Password);
                            DbCommand.Parameters.AddWithValue("@SaLogin", hostSettings.SALogin);
                            DbCommand.Parameters.AddWithValue("@SaPassword", hostSettings.SAPassword);

                            result = DbConnection.ExecuteCommand(DbCommand);
                        }
                    }else {
                        throw new Exception("Unable to Connect");
                    }
                }
                return result;
            }catch {
                throw;
            }
        }
Example #20
0
 public ConnectionContextFactory(IHostSettings hostSettings, IStorageSettings storageSettings, Action <EventHubProducerClientOptions> configureOptions)
 {
     _hostSettings     = hostSettings;
     _storageSettings  = storageSettings;
     _configureOptions = configureOptions;
 }
Example #21
0
        public MainViewModel(IKnifeStoreLogic knifeStoreLogic, IKnifeLogic knifeLogic, IReviewLogic reviewLogic, IHostSettings hostSettings)
        {
            this.knifeStoreLogic = knifeStoreLogic;
            this.knifeLogic      = knifeLogic;
            this.reviewLogic     = reviewLogic;
            this.hostSettings    = hostSettings;

            if (!this.IsInDesignMode)
            {
            }
            else
            {
                this.KnifeStores = new ObservableCollection <KnifeStore>();
                KnifeStore ks1 = new KnifeStore()
                {
                    Address = "Random Strt 8.", Name = "BladeHQ", Website = "www.bladehq.com"
                };
                KnifeStore ks2 = new KnifeStore()
                {
                    Address = "Random Strt 69.", Name = "KnifeCenter", Website = "www.knifecenter.com"
                };
                KnifeStore ks3 = new KnifeStore()
                {
                    Address = "Random Strt 12.", Name = "Boker", Website = "www.boker.de"
                };
                KnifeStore ks4 = new KnifeStore()
                {
                    Address = "Random Strt 9.", Name = "BladeShop", Website = "www.bladeshop.hu"
                };
                KnifeStore ks5 = new KnifeStore()
                {
                    Address = "Random Strt 617.", Name = "KnivesAndtools", Website = "www.knivesandtools.uk"
                };
                this.KnifeStores.Add(ks1);
                this.KnifeStores.Add(ks2);
                this.KnifeStores.Add(ks3);
                this.KnifeStores.Add(ks4);
                this.KnifeStores.Add(ks5);
            }

            this.AddKnifeStoreCmd = new RelayCommand(() => {
                this.knifeStoreLogic.AddKnifeStore(this.KnifeStores, token);
                RefreshKnifeStores();
            }, true);
            this.ModKnifeStoreCmd = new RelayCommand(() => this.knifeStoreLogic.ModKnifeStore(this.SelectedKnifeStore, token), true);
            this.DelKnifeStoreCmd = new RelayCommand(() => {
                this.knifeStoreLogic.DelKnifeStore(this.KnifeStores, this.SelectedKnifeStore, token);
                Knives  = new ObservableCollection <Knife>();
                Reviews = new ObservableCollection <Review>();
            }, true);

            this.AddKnifeCmd = new RelayCommand(() => {
                this.knifeLogic.AddKnife(this.Knives, selectedKnifeStore == null ? string.Empty : selectedKnifeStore.StorageId, token);
                RefreshKnives();
            }, true);
            this.ModKnifeCmd = new RelayCommand(() => this.knifeLogic.ModKnife(SelectedKnife, token), true);
            this.DelKnifeCmd = new RelayCommand(() => {
                this.knifeLogic.DelKnife(Knives, SelectedKnife, token);
                Reviews = new ObservableCollection <Review>();
            }, true);

            this.AddReviewCmd = new RelayCommand(() => {
                this.reviewLogic.AddReview(this.Reviews, selectedKnife == null ? string.Empty : SelectedKnife.SerialNumber, token);
                RefreshReview();
            }, true);
            this.ModReviewCmd = new RelayCommand(() => this.reviewLogic.ModReview(SelectedReview, token), true);
            this.DelReviewCmd = new RelayCommand(() => this.reviewLogic.DelReview(Reviews, SelectedReview, token), true);

            this.GenerateCmd = new RelayCommand(() => GenerateSample(), true);
            this.UpdateCmd   = new RelayCommand(() => RefreshKnifeStores(), true);
            this.GetKnives   = new RelayCommand(() => { RefreshKnives(); Reviews = new ObservableCollection <Review>(); selectedReview = null; }, true);
            this.GetReviews  = new RelayCommand(() => RefreshReview(), true);
            this.UpdateToken = new RelayCommand(() => SetToken(), true);
        }
 public ListenerShould()
 {
     hostSettings    = new ProviderHostSettings(kafkaHost);
     messageSettings = new MessageSettingsIn(onTopic);
     processor       = new Processor();
 }
Example #23
0
 public AuthLogic(IMessenger messengerService, IHostSettings hostSettings)
 {
     this.messengerService = messengerService;
     this.hostSettings     = hostSettings;
 }
Example #24
0
 public IHostSettings GetHostSettings()
 {
     return hostSettings ?? (hostSettings = loader.LoadHostSettings());
 }
Example #25
0
 public ConnectionContextSupervisor(IHostSettings hostSettings, IStorageSettings storageSettings, Action <EventHubProducerClientOptions> configureOptions)
     : base(new ConnectionContextFactory(hostSettings, storageSettings, configureOptions))
 {
 }