當前位置: 首頁>>代碼示例>>Java>>正文


Java TextMessage.getStringProperty方法代碼示例

本文整理匯總了Java中javax.jms.TextMessage.getStringProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java TextMessage.getStringProperty方法的具體用法?Java TextMessage.getStringProperty怎麽用?Java TextMessage.getStringProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jms.TextMessage的用法示例。


在下文中一共展示了TextMessage.getStringProperty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMessageId

import javax.jms.TextMessage; //導入方法依賴的package包/類
private String getMessageId(TextMessage message) throws JMSException {
    String msgId = message.getStringProperty("msgId");
    if (msgId == null) {
    	msgId = message.getStringProperty("sourceId");
    }
    return msgId;
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:8,代碼來源:DlqListener.java

示例2: getMessageId

import javax.jms.TextMessage; //導入方法依賴的package包/類
private static String getMessageId(TextMessage message) throws JMSException {
    String msgId = message.getStringProperty("msgId");
    String type = getMessageType(message);
    if (msgId == null || ("delete".equals(message.getStringProperty("action")) && ("cm_ci".equals(type) || "namespace".equals(type)))) {
        return message.getStringProperty("sourceId");
    }
    return msgId;
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:9,代碼來源:SearchListener.java

示例3: getMessageType

import javax.jms.TextMessage; //導入方法依賴的package包/類
private static String getMessageType(TextMessage message) throws JMSException {
    String type = message.getStringProperty("type");
    if (type == null) {
        return message.getStringProperty("source");
    }
    return type;
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:8,代碼來源:SearchListener.java

示例4: onMessage

import javax.jms.TextMessage; //導入方法依賴的package包/類
public void onMessage(Message message) {
    if (!(message instanceof TextMessage)) {
        LOG.warn("Only text messages allowed, skipping message: {}", message);
        return;
    }

    TextMessage textMessage = (TextMessage) message;
    try {
        LOG.trace("Received message: {}", textMessage.getText());

        String taskName = textMessage.getStringProperty(typeHeader);
        LOG.debug("Received message for task: {}", taskName);
        Object command = taskMapper.map(textMessage.getText(), taskManager.getCommandClass(taskName));

        final String reason = textMessage.getStringProperty(Headers.REASON);
        final String detail = textMessage.getStringProperty(Headers.DETAIL);
        final Status status = Status.valueOf(textMessage.getStringProperty(Headers.STATUS));
        LOG.debug("Received message in status [{}] with reason [{}] with detail [{}]", status, reason, detail);

        switch (status) {
            case COMPLETE:
                Pair<String, CompleteExternalTaskDto> completeTaskPair = taskManager.toCompleteTask(taskName, command);
                taskService.complete(completeTaskPair.getKey(), completeTaskPair.getValue());
                break;

            case FAIL:
                Pair<String, ExternalTaskFailureDto> failTaskPair = taskManager.toFailTask(taskName, command);

                final ExternalTaskFailureDto failureDto = failTaskPair.getValue();
                if (!StringUtils.hasText(failureDto.getErrorMessage())) {
                    failureDto.setErrorMessage(reason);
                }
                if (!StringUtils.hasText(failureDto.getErrorDetails())) {
                    failureDto.setErrorDetails(detail);
                }

                taskService.fail(failTaskPair.getKey(), failureDto);
                break;
        }
    } catch (Exception e) {
        LOG.error("Message processing error", e);
        sendToDlq(textMessage, e);
    }
}
 
開發者ID:EsikAntony,項目名稱:camunda-task-dispatcher,代碼行數:45,代碼來源:JmsExternalCommandListener.java

示例5: readJmsMessage

import javax.jms.TextMessage; //導入方法依賴的package包/類
@Override
public Optional<EventMessage<?>> readJmsMessage(Message msg) throws JMSException {
  if (!(msg instanceof TextMessage)) {
    return Optional.empty();
  }

  final TextMessage textMsg = (TextMessage) msg;

  if (textMsg.getObjectProperty("axon-message-id") == null
          || textMsg.getObjectProperty("axon-message-type") == null) {
    return Optional.empty();
  }
  Map<String, Object> metaData = new HashMap<>();
  Enumeration<String> propertyNames = textMsg.getPropertyNames();
  while (propertyNames.hasMoreElements()) {
    String propertyName = propertyNames.nextElement();
    if (propertyName.startsWith("axon-metadata-")) {
      metaData.put(propertyName.substring("axon-metadata-".length()),
              textMsg.getObjectProperty(propertyName));
    }
  }
  SimpleSerializedObject<String> serializedObject = new SimpleSerializedObject<>(
          textMsg.getText(), String.class,
          textMsg.getStringProperty("axon-message-type"),
          textMsg.getStringProperty("axon-message-revision"));
  SerializedMessage<EventMessage<?>> serializedMessage = new SerializedMessage<>(
          textMsg.getStringProperty("axon-message-id"),
          new LazyDeserializingObject<>(serializedObject, serializer),
          new LazyDeserializingObject<>(MetaData.from(metaData)));
  String timestamp = textMsg.getStringProperty("axon-message-timestamp");
  if (textMsg.propertyExists("axon-message-aggregate-id")) {
    return Optional.of(new GenericDomainEventMessage<>(
            textMsg.getStringProperty("axon-message-aggregate-type"),
            textMsg.getStringProperty("axon-message-aggregate-id"),
            textMsg.getLongProperty("axon-message-aggregate-seq"),
            serializedMessage,
        () -> Instant.parse(timestamp)));
  } else {
    return Optional.of(new GenericEventMessage<>(
            serializedMessage, () -> Instant.parse(timestamp)));
  }
}
 
開發者ID:sventorben,項目名稱:axon-jms,代碼行數:43,代碼來源:DefaultJmsMessageConverter.java

示例6: processMessage

import javax.jms.TextMessage; //導入方法依賴的package包/類
private void processMessage(TextMessage message) throws JsonSyntaxException, JMSException {
  String source = message.getStringProperty("source");
  logger.info("Message from source: " + source);
  String processKey;
  String pokeActivitiProcessId = null;
  Map<String, Object> wfParams = new HashMap<String, Object>();
  if (source.equals("deployment")) {
    CmsDeployment dpmt = gson.fromJson(message.getText(), CmsDeployment.class);
    if (dpmt == null) {
      logger.error("Got bad message:" + message.getText() + "/n end msg");
      return;
    } else {
      if (isDeployerEnabled(dpmt.getNsPath())) {
        notifyIfRequired(dpmt);
        logger.info("Executing deployment using Deployer : " + dpmt.getDeploymentId());
        startDeployment(dpmt);
      } else {
        logger.info("Executing deployment using activiti : " + dpmt.getDeploymentId());
        processKey = getDpmtProcessKey(dpmt);

        if (processKey != null && !processKey.equals("skip")) {
          wfParams.put("dpmt", dpmt);
          wfParams.put("execOrder", 1);
          pokeActivitiProcessId = wfController.startDpmtProcess(processKey, wfParams);
        } else {
          notifyIfRequired(dpmt);
        }
      }
    }


  } else if (source.equals("opsprocedure")) {
    CmsOpsProcedure proc = gson.fromJson(message.getText(), CmsOpsProcedure.class);
    if (proc == null) {
      logger.error("Got bad message:" + message.getText() + "/n end msg");
      return;
    }
    //logger.info()
    if (isDeployerEnabled(proc.getNsPath())) {
      logger.info("Executing procedure using ProcedureRunner : " + proc.getProcedureId());
      startProcedure(proc);
    }
    else {
      processKey = getOpsProcedureProcessKey(proc);
      if (processKey != null && !processKey.equals("skip")) {
        wfParams.put("proc", proc);
        wfParams.put("execOrder", 1);
      } else {
        return;
      }
      pokeActivitiProcessId = wfController.startOpsProcess(processKey, wfParams);
    }
  } else if (source.equals("release")) {
    CmsRelease release = gson.fromJson(message.getText(), CmsRelease.class);
    if (release == null) {
      logger.error("Got bad message:" + message.getText() + "/n end msg");
      return;
    }
    processKey = getDeployReleaseProcessKey(release);
    if (processKey != null && !processKey.equals("skip")) {
      wfParams.put("release", release);
    } else {
      return;
    }
    pokeActivitiProcessId = wfController.startReleaseProcess(processKey, wfParams);
  } else {
    logger.error("Unsupported source:" + source);
    return;
  }
  if (pokeActivitiProcessId != null) {
    wfController.pokeProcess(pokeActivitiProcessId);
  }
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:74,代碼來源:CmsListener.java

示例7: processResponseMessage

import javax.jms.TextMessage; //導入方法依賴的package包/類
private void processResponseMessage(TextMessage msg) throws JMSException {
  long startTime = System.currentTimeMillis();
  String corelationId = msg.getJMSCorrelationID();
  if (corelationId == null) {
    corelationId = msg.getStringProperty("task_id");
  }
  String[] props = corelationId.split("!");
  String processId = props[0];
  String executionId = props[1];
  //String taskName = props[2];

  String woTaskResult = msg.getStringProperty("task_result_code");
  if (logger.isDebugEnabled()) {
    logger.debug("Inductor response >>>>>>" + ((TextMessage) msg).getText());
  }

  String type = msg.getStringProperty("type");
  Map<String, Object> params = new HashMap<>();
  //noinspection UnusedAssignment
  CmsWorkOrderSimpleBase wo = null;
  CmsWorkOrderSimple strippedWo = null;

  if ("opsprocedure".equalsIgnoreCase(type)) {
    wo = gson.fromJson(((TextMessage) msg).getText(), CmsActionOrderSimple.class);
  } else if ("deploybom".equalsIgnoreCase(type)) {
    wo = gson.fromJson(((TextMessage) msg).getText(), CmsWorkOrderSimple.class);
    strippedWo = controllerUtil.stripWO((CmsWorkOrderSimple) wo);
    if (woTaskResult.equalsIgnoreCase(OK_RESPONSE)) {
      try {
        sensorClient.processMonitors((CmsWorkOrderSimple) wo);
      } catch (SensorClientException e) {
        logger.error("Exception occurred in creating monitors",e);
      }
    }
  } else {
    throw new JMSException("the type property of the received msg is unknown - " + type);
  }

  if (strippedWo != null) {
    params.put("wo", strippedWo);
  } else {
    params.put("wo", wo);
  }

  if (woTaskResult.equalsIgnoreCase("200")) {
    params.put(CmsConstants.WORK_ORDER_STATE, "complete");
  } else {
    params.put(CmsConstants.WORK_ORDER_STATE, "failed");
  }

  handleWorkOrderFlow(processId, executionId, params, wo);

  final long processTime = System.currentTimeMillis() - startTime;
  String woCorelationId = processId + executionId;
  wo.getSearchTags().put("cProcessTime",String.valueOf(processTime));
  setWoTimeStamps(wo);
  woPublisher.publishMessage(wo, type, woCorelationId);
  logger.info("Processed iResponse with id "+ corelationId + " result" + woTaskResult+" took(ms) " +processTime);
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:60,代碼來源:InductorListener.java


注:本文中的javax.jms.TextMessage.getStringProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。