コード例 #1
0
  protected void sendLocalMessage(Message message) {
    String destinationName = message.getDestinationName();

    if (Validator.isNotNull(destinationName)) {
      if (_log.isDebugEnabled()) {
        _log.debug("Sending local cluster link message " + message + " to " + destinationName);
      }

      ClusterInvokeThreadLocal.setEnabled(false);

      try {
        _messageBus.sendMessage(destinationName, message);
      } finally {
        ClusterInvokeThreadLocal.setEnabled(true);
      }
    } else {
      _log.error("Local cluster link message has no destination " + message);
    }
  }
  protected void doReceive(Message message) throws Exception {
    ReportRequest reportRequest = (ReportRequest) message.getPayload();

    ReportDesignRetriever reportDesignRetriever = reportRequest.getReportDesignRetriever();

    ReportResultContainer reportResultContainer =
        _reportResultContainer.clone(reportDesignRetriever.getReportName());

    try {
      _reportEngine.compile(reportRequest);
    } catch (ReportGenerationException rge) {
      _log.error("Unable to compile report", rge);

      reportResultContainer.setReportGenerationException(rge);
    } finally {
      Message responseMessage =
          MessageBusUtil.createResponseMessage(message, reportResultContainer);

      responseMessage.setPayload(reportResultContainer);

      MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
    }
  }