jeudi 2 avril 2015

In Amazon rest API i used sleep method for delay purpose on response but i am not getting data.


Map<String, String> params = new TreeMap<String, String>();
params.put("Condition", Service.ALL);
params.put("Version", Service.VERSION);
params.put("Service", Service.SERVICE);
params.put("Operation", Service.ITEM_LOOKUP);
params.put("ItemId", itemId);
params.put("IdType", Service.ASIN);
params.put("ResponseGroup", Service.ITEM_ATTRIBUTES);

String url = helper.sign(params);
String restOutput = restTemplate.getForObject(new URI(url),String.class);
logger.debug("Rest response for popular product {}", restOutput)


I am using Amazon API for fetch data from amazon using rest template. But yesterday when i add TimeUnit.SECONDS.sleep(5) for sleep. First time i got data correctly but currently i am hitting the url but not getting data. i am using below code to hit the request


String restOutput = restTemplate.getForObject(new URI(url), String.class);


after adding sleep method i am not getting data on restOutPut. but when i hit url directly on browser i get data. After removing sleep method i am not getting data. So please if you have any idea then please share with me.





Aucun commentaire:

Enregistrer un commentaire