public List <LocationReadDataQueue> GetLocationGenerate(long count)
        {
            List <LocationReadDataQueue> result = new List <LocationReadDataQueue>();

            for (int i = 0; i < count;)
            {
                var destinationPoint = GetLocation();
                var sourcePoint      = GetLocation();

                LocationReadDataQueue point = new LocationReadDataQueue();
                point.LocationInfoInputDto = new LocationInfoInputDto()
                {
                    DestinationLatitude  = destinationPoint.Latitude,
                    DestinationLongitude = destinationPoint.Longitude,
                    SourceLatitude       = sourcePoint.Latitude,
                    SourceLongitude      = sourcePoint.Longitude
                };
                if (result.Where(c => c.LocationInfoInputDto.DestinationLatitude == point.LocationInfoInputDto.DestinationLatitude &&
                                 c.LocationInfoInputDto.DestinationLongitude == point.LocationInfoInputDto.DestinationLongitude &&
                                 c.LocationInfoInputDto.SourceLatitude == point.LocationInfoInputDto.SourceLatitude &&
                                 c.LocationInfoInputDto.SourceLongitude == point.LocationInfoInputDto.SourceLongitude).Count() == 0)
                {
                    i++;
                    result.Add(point);
                }
            }
            return(result);
        }
        public async Task <LocationWriteDataQueue> GetLocationsDistanceAsync(LocationReadDataQueue locationReadDataQueue)
        {
            Console.WriteLine($"RabbitMQProcessor DataBaseConsumerManager GetLocationsDistance method  => Calısma zamanı: {DateTime.Now.ToShortTimeString()}");

            LocationWriteDataQueue locationWriteDataQueue = new LocationWriteDataQueue();

            locationWriteDataQueue.LocationReadDataQueue = locationReadDataQueue;
            locationWriteDataQueue.Distance = DistanceCalculate(locationReadDataQueue.LocationInfoInputDto.SourceLatitude,
                                                                locationReadDataQueue.LocationInfoInputDto.SourceLongitude,
                                                                locationReadDataQueue.LocationInfoInputDto.DestinationLatitude,
                                                                locationReadDataQueue.LocationInfoInputDto.DestinationLongitude,
                                                                'K'
                                                                );

            var a = await AddAsync(new DominosLocation
            {
                DestinationLatitude  = locationWriteDataQueue.LocationReadDataQueue.LocationInfoInputDto.DestinationLatitude,
                DestinationLongitude = locationWriteDataQueue.LocationReadDataQueue.LocationInfoInputDto.DestinationLongitude,
                SourceLatitude       = locationWriteDataQueue.LocationReadDataQueue.LocationInfoInputDto.SourceLatitude,
                SourceLongitude      = locationWriteDataQueue.LocationReadDataQueue.LocationInfoInputDto.SourceLongitude
            });

            if (a.Id != 0)
            {
                await QueueDatabaseCreatedAfterSendFileProcess(locationWriteDataQueue);
            }
            var data = await Task.FromResult(locationWriteDataQueue);

            return(data);
        }
        private void Consumer_Received(object sender, BasicDeliverEventArgs ea)
        {
            try
            {
                _semaphore.Wait();
                LocationReadDataQueue message = _objectDataConverter.JsonToObject <LocationReadDataQueue>(Encoding.UTF8.GetString(ea.Body));
                MessageReceived?.Invoke(this, message);

                Task.Run(() =>
                {
                    try
                    {
                        var task = _locationInfoService.GetLocationsDistanceAsync(message);
                        task.Wait();
                        var result = task.Result;

                        var insertedTask = _locationInfoService.QueueDatabaseCreatedAfterSendFileProcess(result);
                        insertedTask.Wait();

                        MessageProcessed?.Invoke(this, result);
                    }
                    catch (Exception ex)
                    {
                        //throw new Exception(ex.InnerException.Message.ToString());
                    }
                    finally
                    {
                        _channel.BasicAck(ea.DeliveryTag, false);
                        _semaphore.Release();
                    }
                });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.Message.ToString());
            }
        }