当前位置: 首页>>代码示例>>Java>>正文


Java MessageBusUtil类代码示例

本文整理汇总了Java中com.liferay.portal.kernel.messaging.MessageBusUtil的典型用法代码示例。如果您正苦于以下问题:Java MessageBusUtil类的具体用法?Java MessageBusUtil怎么用?Java MessageBusUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageBusUtil类属于com.liferay.portal.kernel.messaging包,在下文中一共展示了MessageBusUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAfterCreate

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Override
public void onAfterCreate(DossierFile model) throws ModelListenerException {
	_log.info("After Created........... ");
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	try {
		// Binhth add message bus to processing KySO file
		Message message = new Message();
		DossierPart dossierPart = DossierPartLocalServiceUtil.fetchByTemplatePartNo(model.getGroupId(),
				model.getDossierTemplateNo(), model.getDossierPartNo());
		
		JSONObject msgDataESign = JSONFactoryUtil.createJSONObject();
		msgDataESign.put("userId", model.getUserId());
		msgDataESign.put("eSign", dossierPart.getESign());
		msgDataESign.put("fileEntryId", model.getFileEntryId());

		message.put("msgToEngine", msgDataESign);
		MessageBusUtil.sendMessage("kyso/engine/out/destination", message);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:DossierFileKySoListenner.java

示例2: updateFormData

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
public RegistrationForm updateFormData(long groupId, long registrationId, String referenceUid, String formData,
		ServiceContext serviceContext) 
	throws PortalException, SystemException {

	RegistrationForm registrationForm = registrationFormPersistence.findByG_REGID_REFID(groupId, registrationId, referenceUid);

	String jrxmlTemplate = registrationForm.getFormReport();

	registrationForm.setFormData(formData);
	registrationForm.setIsNew(true);

	Message message = new Message();

	JSONObject msgData = JSONFactoryUtil.createJSONObject();
	msgData.put("className", RegistrationForm.class.getName());
	msgData.put("classPK", registrationForm.getPrimaryKey());
	msgData.put("jrxmlTemplate", jrxmlTemplate);
	msgData.put("formData", formData);
	msgData.put("userId", serviceContext.getUserId());

	message.put("msgToEngine", msgData);
	MessageBusUtil.sendMessage("jasper/engine/out/destination", message);

	return registrationFormPersistence.update(registrationForm);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:RegistrationFormLocalServiceImpl.java

示例3: _notifyEvent

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
private void _notifyEvent(MqttClient client, String event, Throwable e) {

		Message mb = new Message();

		mb.put("event", event);

		if (client != null) {
			mb.put("brokerUrl", client.getServerURI());
		}

		if (e != null) {
			mb.put("error", e.getMessage());
		}

		MessageBusUtil.sendMessage(
			PortletPropsValues.MQTT_EVENTS_DESTINATION, mb);
	}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:18,代码来源:MqttLocalServiceImpl.java

示例4: receive

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Override
public void receive(Message message) {

	try {
		Message mb = new Message();

		mb.put("topic", "Sysdata-AG/aaaa/" + PwdGenerator.getPassword(4));

		mb.setPayload(PwdGenerator.getPassword(64).getBytes());

		MessageBusUtil.sendMessage("mqtt/publish", mb);

		_log.info(mb.toString());
	}
	catch (Exception e) {
		_log.error(e);
	}
}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:19,代码来源:SchedulerMessageListener.java

示例5: log

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
/** 
 * This function use message bus for add user's activity
 * 
 * Version: OEP 1.1
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  20-April-2015  ThongDV    Create new
 * @param action
 * @param description
 * @param serviceContext
 * @throws SystemException 
 */
public void log(String action, String description,ServiceContext serviceContext){
	try {
		User user=PortalUtil.getUser(serviceContext.getRequest());
		Message message = new Message();
		message.put(UserLogKeys.UserActivityMessageKeys.ACTION, action);
		message.put(UserLogKeys.UserActivityMessageKeys.DESCRIPTION, description);
		message.put(UserLogKeys.UserActivityMessageKeys.USER_ID, serviceContext.getUserId());
		message.put(UserLogKeys.UserActivityMessageKeys.GROUP_ID, serviceContext.getScopeGroupId());
		message.put(UserLogKeys.UserActivityMessageKeys.COMPANY_ID, serviceContext.getCompanyId());
		message.put(UserLogKeys.UserActivityMessageKeys.EMAIL, user.getEmailAddress());
		message.put(UserLogKeys.UserActivityMessageKeys.USER_NAME, user.getScreenName());
		message.put(UserLogKeys.UserActivityMessageKeys.CREATE_DATE, new Date());
		message.put(UserLogKeys.UserActivityMessageKeys.SITE, serviceContext.getThemeDisplay().getSiteGroupName());
		message.put(UserLogKeys.UserActivityMessageKeys.PAGE, ContextUtil.getPage(serviceContext.getThemeDisplay()));
		message.put(UserLogKeys.UserActivityMessageKeys.IP, user.getLogin());
		message.put(UserLogKeys.UserActivityMessageKeys.SESSION_ID, serviceContext.getRequest().getSession().getId());
		message.put(UserLogKeys.UserActivityMessageKeys.URL, serviceContext.getCurrentURL());
		message.put(UserLogKeys.UserActivityMessageKeys.USER_AGENT, serviceContext.getUserAgent());
		MessageBusUtil.sendMessage(UserLogKeys.DESTINATION, message);
	} catch (Exception e) {
		log.error(e);
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:38,代码来源:UserActivityLocalServiceImpl.java

示例6: exportCourse

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
public void exportCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
	
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);	
	ServiceContext serviceContext = ServiceContextFactory.getInstance(Course.class.getName(), actionRequest);
	
	long groupId  = ParamUtil.getLong(actionRequest, "groupId", 0);
	String fileName  = ParamUtil.getString(actionRequest, "exportFileName", "New course exported");
	if(log.isDebugEnabled()){
		log.debug("groupId:"+groupId);
		log.debug("fileName:"+fileName);
	}
	
	Message message = new Message();
	message.put("groupId", groupId);
	message.put("fileName", fileName);
	message.put("themeDisplay", themeDisplay);
	message.put("serviceContext", serviceContext);
	MessageBusUtil.sendMessage("liferay/lms/courseExport", message);
	
	SessionMessages.add(actionRequest, "courseadmin.export.confirmation.success");

}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:CourseAdmin.java

示例7: receive

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	if(log.isDebugEnabled())log.debug("CleanLearningActivityTries receive");
	Message responseMessage = MessageBusUtil.createResponseMessage(message);
	responseMessage.setPayload("RECEIVED");
	try{
		this.la = (LearningActivity)message.get("learningActivity");	
		this.user = (User)message.get("userc");
		activityTriesDeleted = (ActivityTriesDeleted)message.get("activityTriesDeleted");
		onlyNotPassed = (Boolean)message.get("onlyNotPassed");
		process();
		MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
	}catch(Exception e){
		if(log.isInfoEnabled())log.info(e.getMessage());
		if(log.isDebugEnabled())e.printStackTrace();
		
		e.printStackTrace();
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:CleanLearningActivityTriesAllUsers.java

示例8: messageArrived

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Override
public void messageArrived(String topic, MqttMessage message)
	throws Exception {

	Message mb = new Message();

	mb.put("topic", topic);
	mb.put("qos", message.getQos());
	mb.put("retained", message.isRetained());

	String payload = new String(message.getPayload());

	mb.setPayload(payload);

	MessageBusUtil.sendMessage(
		PortletPropsValues.MQTT_MESSAGES_DESTINATION, mb);

	boolean logInfo = PrefsPropsUtil.getBoolean(
		PortletPropsKeys.MQTT_EVENTS_LOGINFO,
		PortletPropsValues.MQTT_EVENTS_LOGINFO);

	if (logInfo) {
		_log.info(String.format("arrived [%s,%s,%s] %s",
			topic, message.getQos(), message.isRetained()?"R":"",
				payload));
	}
}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:28,代码来源:MqttLocalServiceImpl.java

示例9: deleteAllURL

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
public void deleteAllURL(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
	
	log.debug("***deleteAllURL***");
	
	long actId = ParamUtil.getInteger(actionRequest, "resId");
	ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);    
	
	if(log.isDebugEnabled())log.debug(actId); 

	LearningActivity la = LearningActivityLocalServiceUtil.getLearningActivity(actId);
	if(la!=null){
		Message message=new Message();
		message.put("learningActivity",la);
		message.put("userc",themeDisplay.getUser());
		message.put("activityTriesDeleted", ActivityTriesDeletedLocalServiceUtil.addActivityTriesDeleted(la.getGroupId(), la.getActId(), themeDisplay.getUserId()));
		message.put("onlyNotPassed", true);
		message.setResponseId("2222");

		MessageBusUtil.sendMessage("liferay/lms/cleanTriesAllUsers", message);
	}
	

	actionResponse.setRenderParameter("resId", String.valueOf(actId));
	actionResponse.setRenderParameter("califications", String.valueOf(true));
	
	SessionMessages.add(actionRequest, "ok-deleting-tries");
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:28,代码来源:LmsActivitiesList.java

示例10: deleteURL

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
public void deleteURL(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

		long actId = ParamUtil.getInteger(actionRequest, "resId");
		long userId = ParamUtil.getInteger(actionRequest, "userId");
		ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);    

		if(log.isDebugEnabled()){
			log.debug(actId);
			log.debug(userId);
		}

		LearningActivity la = LearningActivityLocalServiceUtil.getLearningActivity(actId);
		User user = UserLocalServiceUtil.getUser(userId);
		
		if(la!=null&&user!=null){
			Message message=new Message();
			message.put("learningActivity",la);
			message.put("user",user);
			message.put("userc",themeDisplay.getUser());
			message.setResponseId("1111");
			//message.setResponseDestinationName("liferay/lms/cleanTriesUser");
			//MessageBusUtil.sendMessage("liferay/lms/cleanTriesUser", message);
			
			log.debug("Learning Activity: "+la.getTitle(themeDisplay.getLocale()));
			log.debug("User "+user.getScreenName());
			String resultado = (String)MessageBusUtil.sendSynchronousMessage("liferay/lms/cleanTriesUser", message);
			log.debug("Result "+resultado);
		}
		
		
		
		actionResponse.setRenderParameter("resId", String.valueOf(actId));
		actionResponse.setRenderParameter("userId", String.valueOf(userId));
		actionResponse.setRenderParameter("califications", String.valueOf(true));
		
	}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:37,代码来源:LmsActivitiesList.java

示例11: receive

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	Message responseMessage = MessageBusUtil.createResponseMessage(message);

	responseMessage.setPayload("RECEIVED");

	try{
		this.la = (LearningActivity)message.get("learningActivity");
		this.user = (User)message.get("user");
		User userc = (User)message.get("userc");

		createInstance(la.getCompanyId(),la.getGroupId(),userc.getUserId(), la.getModuleId(), la.getActId());
		
		if(log.isDebugEnabled())log.debug(" LearningActivity: " + la.getTitle(Locale.getDefault()) + " - " + la.getActId() + " - " +user.getFullName());
		
		process();
		MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);

	}catch(Exception e){
		if(log.isInfoEnabled())log.info(e.getMessage());
		if(log.isDebugEnabled())e.printStackTrace();
	} finally {
		endInstance();
	}
	
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:28,代码来源:CleanLearningActivityTriesUser.java

示例12: resendMessage

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
public static void resendMessage(Message message) {

		int retryCount = message.getInteger("retryCount");
		retryCount++;
		message.put("retryCount", retryCount);

		MessageBusUtil.sendMessage(DestinationNames.SOCIAL_ACTIVITY_PROCESSOR, message);
	}
 
开发者ID:slemarchand,项目名称:gamification-portlet,代码行数:9,代码来源:MessageSender.java

示例13: updateFormData

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
public DossierFile updateFormData(long groupId, long dossierId, String referenceUid, String formData,
		ServiceContext serviceContext) throws PortalException, SystemException {

	// User user =
	// userPersistence.findByPrimaryKey(serviceContext.getUserId());
	DossierFile dossierFile = dossierFilePersistence.findByDID_REF(dossierId, referenceUid);

	// dossierFileLocalService.getDossierFileByReferenceUid(dossierId,
	// referenceUid);

	String jrxmlTemplate = dossierFile.getFormReport();

	if (Validator.isNull(jrxmlTemplate)) {
		DossierPart dossierPart = dossierPartLocalService.fetchByTemplatePartNo(groupId,
				dossierFile.getDossierTemplateNo(), dossierFile.getDossierPartNo());

		if (dossierPart == null) {
			throw new NoSuchDossierPartException();
		}

		jrxmlTemplate = dossierPart.getFormReport();

		dossierFile.setFormReport(jrxmlTemplate);
	}

	dossierFile.setFormData(formData);
	dossierFile.setIsNew(true);

	// Binhth add message bus to processing jasper file
	Message message = new Message();

	JSONObject msgData = JSONFactoryUtil.createJSONObject();
	msgData.put("className", DossierFile.class.getName());
	msgData.put("classPK", dossierFile.getDossierFileId());
	msgData.put("jrxmlTemplate", jrxmlTemplate);
	msgData.put("formData", formData);
	msgData.put("userId", serviceContext.getUserId());

	message.put("msgToEngine", msgData);
	MessageBusUtil.sendMessage("jasper/engine/out/destination", message);

	return dossierFilePersistence.update(dossierFile);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:45,代码来源:DossierFileLocalServiceImpl.java

示例14: _doReceiveJasperRequest

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
private void _doReceiveJasperRequest(Message message) {
	// TODO Auto-generated method stub
	_log.info("Jasper processing .............................");
	JSONObject msgData = (JSONObject) message.get("msgToEngine");

	File file = FileUtil.createTempFile(JRReportUtil.DocType.PDF.toString());

	try {

		long userId = msgData.getLong("userId");

		long classPK = msgData.getLong("classPK");

		String className = msgData.getString("className");
		
		JSONObject jsonData = JSONFactoryUtil.createJSONObject();
		try {
			jsonData = JSONFactoryUtil.createJSONObject(msgData.getString("formData"));
		} catch (JSONException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

		String fileExport = JRReportUtil.createReportFile(msgData.getString("jrxmlTemplate"),
				jsonData.toJSONString(), null, file.getCanonicalPath());

		if (Validator.isNotNull(fileExport)) {
			
			_log.info("Jasper export success: " + fileExport);
			
			JSONObject msgDataIn = JSONFactoryUtil.createJSONObject();
			msgDataIn.put("className", className);
			msgDataIn.put("classPK", classPK);
			msgDataIn.put("userId", userId);
			msgDataIn.put("filePath", fileExport );
			
			message.put("msgToEngine", msgDataIn);
			MessageBusUtil.sendMessage("jasper/dossier/in/destination", message);
		}

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:Engine.java

示例15: send

import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入依赖的package包/类
public void send(String destinationName, Message message) {
    MessageBusUtil.sendMessage(destinationName, message);
}
 
开发者ID:rivetlogic,项目名称:liferay-elasticsearch-integration,代码行数:4,代码来源:PluginMessageSender.java


注:本文中的com.liferay.portal.kernel.messaging.MessageBusUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。