List of usage examples for com.liferay.portal.kernel.messaging Message getValues
public Map<String, Object> getValues()
From source file:com.liferay.osb.scv.internal.messaging.SourceUserMapperMessageListener.java
License:Open Source License
@Override protected void doReceive(Message message) throws Exception { try {//w w w. j a va 2 s. co m Map<String, Object> parameters = message.getValues(); long mappingDataSourceId = GetterUtil.getLong(parameters.get("mappingDataSourceId")); String method = String.valueOf(parameters.get("method")); Map<String, List<String>> fields = (Map) parameters.get("fields"); String fieldsString = null; if (fields != null) { JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); for (Map.Entry<String, List<String>> entrySet : fields.entrySet()) { jsonObject.put(entrySet.getKey(), StringUtil.merge(entrySet.getValue())); } fieldsString = jsonObject.toString(); } sendResponse(message.getResponseDestinationName(), message.getResponseId(), mappingDataSourceId, method, fieldsString); } catch (Exception e) { e.printStackTrace(); } }
From source file:de.uhh.l2g.plugins.util.PortletScheduler.java
License:Open Source License
@Override public void receive(Message message) throws MessageListenerException { String values = "No values"; // Debug Information on running job if (message != null) { LOG.info("Message :" + message.toString()); Thread thread = Thread.currentThread(); LOG.info("Thread :" + thread.getContextClassLoader()); LOG.info("Thread :" + thread.toString()); Map<String, Object> map = message.getValues(); LOG.info(message.get(SchedulerEngine.DESTINATION_NAME) + " " + message.getDestinationName() + " " + message.getValues().get(SchedulerEngine.DESTINATION_NAME) + " " + message.getDestinationName()); values = map.toString();/*from ww w .j a v a2 s. c om*/ } LOG.info("Portlet Scheduler running... " + values); }
From source file:de.uhh.l2g.plugins.util.StatisticsScheduler.java
License:Open Source License
@Override public void receive(Message message) throws MessageListenerException { //uncoment for further debug messages //super.receive(message); LOG.info("Statistics Scheduler running " + message.getValues().get(SchedulerEngine.JOB_NAME).toString() + "..."); //Do Job..../* w w w. j a va 2 s . c o m*/ int privateVideos = 0; int publicVideos = 0; try { publicVideos = VideoLocalServiceUtil.getByOpenAccess(1).size(); privateVideos = VideoLocalServiceUtil.getByOpenAccess(0).size(); //TODO can not get the service context for using the addEntry method, because of the scheduler! And can't find workaround. StatisticLocalServiceUtil.add(privateVideos, publicVideos); } catch (PortalException e) { LOG.info("Statistics Scheduler failed."); } catch (SystemException e) { LOG.info("Statistics Scheduler failed."); } //Job end LOG.info("Statistics Scheduler finished."); }