• 0
Sign in to follow this  
Guest RodrigoDL

Notificaciones Duplicadas

Question

Guest RodrigoDL

Hola, estoy reciviendo notificaciones duplicadas y es imposible detectar cuando estan duplicadas porque vienen practicamente en el mismo segundo:

 

Mon, 21 Nov 2016 21:09:12 +0000 [216.33.196.25] GOT JSON:{"resource":"/orders/1217489125","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-21T21:09:08.757Z","received":"2016-11-21T21:09:08.732Z"}
Mon, 21 Nov 2016 21:09:12 +0000 [216.33.196.25] GOT JSON:{"resource":"/orders/1217489125","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-21T21:09:08.809Z","received":"2016-11-21T21:09:08.779Z"}
Mon, 21 Nov 2016 21:09:14 +0000 [216.33.196.25] GOT JSON:{"resource":"/orders/1217489125","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-21T21:09:10.737Z","received":"2016-11-21T21:09:10.685Z"}
Mon, 21 Nov 2016 21:12:18 +0000 [216.33.196.25] GOT JSON:{"resource":"/orders/1217489125","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-21T21:12:14.555Z","received":"2016-11-21T21:12:14.546Z"}
Mon, 21 Nov 2016 21:12:53 +0000 [216.33.196.25] GOT JSON:{"resource":"/orders/1217489125","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-21T21:12:50.162Z","received":"2016-11-21T21:12:50.155Z"}
 

Alguna idea que puede ser?

Gracias

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Guest RodrigoDL

Mas notificaciones duplicadas:

Tue, 22 Nov 2016 05:22:56 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:22:52.748Z","received":"2016-11-22T05:22:52.743Z"}
Tue, 22 Nov 2016 05:22:56 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:22:52.808Z","received":"2016-11-22T05:22:52.798Z"}
Tue, 22 Nov 2016 05:23:00 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:22:56.945Z","received":"2016-11-22T05:22:56.937Z"}
Tue, 22 Nov 2016 05:23:03 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:23:00.110Z","received":"2016-11-22T05:23:00.100Z"}
Tue, 22 Nov 2016 05:23:16 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:23:12.829Z","received":"2016-11-22T05:23:12.818Z"}
Tue, 22 Nov 2016 05:54:58 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:54:54.589Z","received":"2016-11-22T05:54:54.571Z"}
Tue, 22 Nov 2016 05:54:59 +0000 [216.33.196.25] GOT mpIPN JSON:{"resource":"/orders/1224153122","user_id":"90124092","topic":"orders","application_id":7898406971566818,"attempts":1,"sent":"2016-11-22T05:54:55.215Z","received":"2016-11-22T05:54:55.201Z"}

Share this post


Link to post
Share on other sites
  • 0

Lembrando que você deve enviar um Status 200 a cada notificação recebida, assim a mesma sai da fila de reenvio. 

header('HTTP/1.1 200 OK', true, 200);

Leia a documentação: 

 

http://developers.mercadolibre.com/products-receive-notifications/

 

Olha o que fala a documentação: 

 

"Since we will send a POST to your URL, your application must acknowledge the reception with an HTTP status code 200, otherwise the message will be considered undelivered and it will be retried"

Share this post


Link to post
Share on other sites
  • 0

Marcos,

se ele não manda o 200 ACK, mudaria o contador de tentativa(attempt). Cheguei até a pensar que poderiam ser diversas aplicações, mas o número da aplicação é sempre igual.
 

 

Lembrando que você deve enviar um Status 200 a cada notificação recebida, assim a mesma sai da fila de reenvio. 

header('HTTP/1.1 200 OK', true, 200);

Leia a documentação: 

 

http://developers.mercadolibre.com/products-receive-notifications/

 

Olha o que fala a documentação: 

 

"Since we will send a POST to your URL, your application must acknowledge the reception with an HTTP status code 200, otherwise the message will be considered undelivered and it will be retried"

Share this post


Link to post
Share on other sites
  • 0

Isso é uma característica da API (ou erro, na minha opinião). Existem "triggers" para cada alteração de cada atributo (ou grupo de atributos) do pedido, então se alterar 2 atributos (ou grupos) ao mesmo tempo podem ser enviadas 2 ou mais notificações praticamente no mesmo milisegundo. O tratamento sugerido é armazenar a notificação em uma fila e ter um processamento em background para os itens na fila. A tecnologia para armazenar e controlar o processamento desta fila fica a seu critério.

 

Ao inserir na fila, dependendo de como você implementar isso, pode verificar se existe alguma notificação do mesmo "topic" e "resource" na fila, aguardando processamento e, neste caso, não precisa inserir novamente.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this