public void ProcessJob(string str) { try { JobUploadedImg job = JobUploadedImg.FromJson(str); string imageIdOld = _imgAdapterSql.GetImageId(job.ProductId); if (!string.IsNullOrEmpty(imageIdOld)) { _producerDelImbo.PublishString(imageIdOld); } MongoDB.Driver.IMongoClient mongoClient = new MongoClient("mongodb://172.22.1.226:27017"); var collection = mongoClient.GetDatabase("imbo").GetCollection <BsonDocument>("image"); var filter = Builders <BsonDocument> .Filter.Eq("imageIdentifier", job.ImageId); var cursor = collection.FindSync(filter); while (cursor.MoveNext()) { int x = Convert.ToInt32(cursor.Current.ElementAt(0).GetValue("width")); int y = Convert.ToInt32(cursor.Current.ElementAt(0).GetValue("height")); _imgAdapterSql.UpdateImboProcess(job.ProductId, job.ImageId, x, y); break; } //PushChangeMainInfo RabbitMQAdapter.Instance.PushProductToQueueChangeMainInfo(new List <long>() { job.ProductId }); } catch (Exception ex) { log.Error(ex); } }
public override void ProcessMessage(BasicDeliverEventArgs message) { string mss = UTF8Encoding.UTF8.GetString(message.Body); log.Info(mss); JobUploadedImg job = JobUploadedImg.FromJson(mss); if (job != null) { ImboImageService.CallThumb(job.ImageId, ConfigImbo.ListThumb); } this.GetChannel().BasicAck(message.DeliveryTag, true); }
public void ProcessJob(string str) { JobUploadedImg job = JobUploadedImg.FromJson(str); string imageIdOld = _imgAdapterSql.GetImageId(job.ProductId); if (!string.IsNullOrEmpty(imageIdOld)) { _producerDelImbo.PublishString(new JobDelImgImbo() { ImageId = imageIdOld }.ToJson()); } _imgAdapterSql.UpdateImboProcess(job.ProductId, job.ImageId, 0, 0); }