Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TaskQueue POST request with a file or byte[] as parameter (Java)

Is it possible to invoke a taskqueue with a parameter of a different type then String? My code currently looks like this but the code in the queue is never reached: (Playframework coding)

public static void addOrUpdateShops(byte[] xmlFile) {
  checkUserExists();
  QueueFactory.getDefaultQueue().add(withUrl("/DataTransferController/addOrUpdateShopz").param( "xmlFile", xmlFile).method(TaskOptions.Method.POST));
  renderText("Added to queue");
}

public static void addOrUpdateShopz(byte[] xmlFile) throws Exception {
  Logger.debug("Running queue task (addOrUpdateShopszz)");
  ShopModelUtilities.addShops(xmlFile);
}

Thx

like image 770
user1271669 Avatar asked Jun 19 '26 01:06

user1271669


1 Answers

Yes you can. Use TaskOptions.Builder.withPayload(byte[], String) or on existing TaskOptions.payload(byte[], String).

like image 117
Peter Knego Avatar answered Jun 20 '26 16:06

Peter Knego