Exemple #1
0
        private void BuildContractChangeNotifications(List <ContractChange> changes)
        {
            try
            {
                Customer customer = _customerRepo.GetCustomerByCustomerNumber(changes[0].CustomerNumber,
                                                                              changes[0].BranchId);

                if (customer != null)
                {
                    var notifcation = BuildContractChangeNotification(changes, customer);
                    _queueRepo.PublishToDirectedExchange(notifcation.ToJson(),
                                                         BEKConfiguration.Get("RabbitMQNotificationServer"),
                                                         BEKConfiguration.Get("RabbitMQNotificationPublisherUserName"),
                                                         BEKConfiguration.Get("RabbitMQNotificationPublisherUserPassword"),
                                                         BEKConfiguration.Get("RabbitMQNotificationVHost"),
                                                         BEKConfiguration.Get("RabbitMQNotificationExchangeV2"),
                                                         Constants.RABBITMQ_NOTIFICATION_HASNEWS_ROUTEKEY);
                    _log.WriteInformationLog(string.Format("Published to notification exchange, {0}",
                                                           notifcation.ToJson()));
                }
            }
            catch (Exception ex)
            {
                _log.WriteErrorLog("Error creating contract change notification", ex);
            }

            if (changes != null &&
                changes.Count > 0)
            {
                _contractChangesRepo.Update(changes.First().ParentList_Id, true);
            }
        }
Exemple #2
0
 public ElasticSearch()
 {
     _elasticSearchUri = new Uri(BEKConfiguration.Get("ElasticSearchURL"));
     _connectionConfig = new ConnectionSettings(_elasticSearchUri);
     _client           = new ElasticClient(_connectionConfig);
 }