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


Java Message类代码示例

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


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

示例1: onAfterCreate

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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.Message; //导入依赖的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: receive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	// TODO Auto-generated method stub
	try {
		JSONObject msgData = (JSONObject) message.get("msgToEngine");
		
		boolean dossierFileSync = msgData.getBoolean("dossierFileSync");
		
		if (dossierFileSync) {
			_doReceiveKySoRequest(message);
		} else {
			_doReceiveJasperRequest(message);
		}
		
	} catch (Exception e) {
		_log.error("Unable to process message " + message, e);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:19,代码来源:Engine.java

示例4: _notifyEvent

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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

示例5: receive

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

	String topic = message.getString("topic");
	int qos = message.getInteger("qos");
	byte[] payload = (byte[])message.getPayload();

	try {
		if (!MqttLocalServiceUtil.isConnected()) {
			MqttLocalServiceUtil.connect();
		}

		MqttLocalServiceUtil.publish(topic, payload, qos);
	}
	catch (SystemException | MqttException e) {
		_log.error(e);
	}
}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:19,代码来源:MQTTPublishMessageListener.java

示例6: receive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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

示例7: log

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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

示例8: doReceive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的package包/类
@Override
protected void doReceive(Message message) throws Exception {
	String command = message.getString("command");
	String servletContextName = message.getString("servletContextName");

	if (command.equals("undeploy") &&
			servletContextName.equals(getServletContextName())) {
		DictAttributeLocalServiceUtil.clearService();

		DictAttributeServiceUtil.clearService();
		DictCollectionLocalServiceUtil.clearService();

		DictCollectionServiceUtil.clearService();
		DictDataLocalServiceUtil.clearService();

		DictDataServiceUtil.clearService();
		DictMetaDataLocalServiceUtil.clearService();

		DictMetaDataServiceUtil.clearService();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:22,代码来源:ClpMessageListener.java

示例9: receive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	long courseId = message.getLong("courseId");
	if(courseId!=0){
		try {
			Course course = CourseLocalServiceUtil.getCourse(courseId);
			CourseEval courseEval = new CourseEvalRegistry().getCourseEval(course.getCourseEvalId());
			if(!courseEval.updateCourse(course)){
				_log.error("Error during average evaluation: "+courseId);
			}

		} catch (NestableException e) {
			_log.error("Error during average evaluation: "+courseId, e);
		}
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:18,代码来源:EvaluationAvgPortlet.java

示例10: exportCourse

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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

示例11: receive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的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

示例12: receive

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

		boolean newsletterIsEnabled = CustomPortalServiceHandler.isConfigEnabled(E_ConfigKey.ENABLE_NEWSLETTER);
		
		if (newsletterIsEnabled)
			this.sendNewsletter();

		m_objLog.info("Ten-Minute scheduler update done.");
	} catch (final Throwable t) {
		m_objLog.warn(
		        "Could not exec daily schedule due to: " + t.getMessage(),
		        t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:17,代码来源:TenMinuteScheduler.java

示例13: receive

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

		// removeOrganisationsWithoutUsers();
		// removeOffersWithoutOrganisations();
		// removeOrphanedAddresses();
		// removeOrphanedRegions();
		// removeOffersWithoutAddresses();

		m_objLog.info("Daily scheduler update done.");
	} catch (final Throwable t) {
		m_objLog.warn(
		        "Could not exec daily schedule due to: " + t.getMessage(),
		        t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:18,代码来源:DailyScheduler.java

示例14: doReceive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的package包/类
@Override
protected void doReceive(Message message) throws Exception {
    String command = message.getString("command");
    String servletContextName = message.getString("servletContextName");

    if (command.equals("undeploy") &&
            servletContextName.equals(getServletContextName())) {
        ArtigoLocalServiceUtil.clearService();

        ContribuicaoLocalServiceUtil.clearService();

        EstruturaLocalServiceUtil.clearService();

        WikiLegisServiceUtil.clearService();
    }
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:17,代码来源:ClpMessageListener.java

示例15: doReceive

import com.liferay.portal.kernel.messaging.Message; //导入依赖的package包/类
@Override
protected void doReceive(Message message) throws Exception {
    String command = message.getString("command");
    String servletContextName = message.getString("servletContextName");

    if (command.equals("undeploy") &&
            servletContextName.equals(getServletContextName())) {
        ChatRoomLocalServiceUtil.clearService();

        ChatRoomServiceUtil.clearService();
        ChatRoomMessageLocalServiceUtil.clearService();

        ChatRoomTwitterLocalServiceUtil.clearService();

        ChatRoomUserLocalServiceUtil.clearService();

        ChatRoomVideoLocalServiceUtil.clearService();
    }
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:20,代码来源:ClpMessageListener.java


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