本文整理汇总了Java中com.liferay.portal.kernel.messaging.MessageBusUtil.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBusUtil.sendMessage方法的具体用法?Java MessageBusUtil.sendMessage怎么用?Java MessageBusUtil.sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.messaging.MessageBusUtil
的用法示例。
在下文中一共展示了MessageBusUtil.sendMessage方法的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();
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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");
}
示例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();
}
}
示例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));
}
}
示例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");
}
示例10: 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();
}
}
示例11: 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);
}
示例12: 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);
}
示例13: _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();
}
}
示例14: send
import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入方法依赖的package包/类
public void send(String destinationName, Message message) {
MessageBusUtil.sendMessage(destinationName, message);
}
示例15: sendMessage
import com.liferay.portal.kernel.messaging.MessageBusUtil; //导入方法依赖的package包/类
private static void sendMessage(Message message) {
MessageBusUtil.sendMessage(DestinationNames.SOCIAL_ACTIVITY_PROCESSOR, message);
}