Package org.springframework.integration

Examples of org.springframework.integration.MessageHandlingException


    final JobExecution jobExecution;

    try {
      jobExecution = this.jobLaunchingMessageHandler.launch(jobLaunchRequest);
    } catch (JobExecutionException e) {
      throw new MessageHandlingException(requestMessage, e);
    }

    return jobExecution;

  }
View Full Code Here


              WebSocketEventType.WEBSOCKET_CLOSED, state.getPath(), state.getQueryString());
          this.getTheConnection().publishEvent(event);
          this.close();
        }
        catch (Exception e) {
          throw new MessageHandlingException(message, "Send failed", e);
        }
      }
      else if (state == null || state.isCloseInitiated()) {
        if (logger.isWarnEnabled()) {
          logger.warn("Message dropped - close initiated:" + message);
        }
      }
      else if ((payload.getType() & 0xff) == WebSocketFrame.TYPE_INVALID) {
        if (logger.isDebugEnabled()) {
          logger.debug("Invalid:" + payload.getPayload());
        }
        this.protocolViolation(message);
      }
      else if (payload.getType() == WebSocketFrame.TYPE_FRAGMENTED_CONTROL) {
        if (logger.isDebugEnabled()) {
          logger.debug("Fragmented Control Op");
        }
        this.protocolViolation(message);
      }
      else if (payload.getType() == WebSocketFrame.TYPE_PING) {
        try {
          if (logger.isDebugEnabled()) {
            logger.debug("Ping received on " + this.getConnectionId() + ":"
                + new String(payload.getBinary(), "UTF-8"));
          }
          if (payload.getBinary().length > 125) {
            this.protocolViolation(message);
          }
          else {
            WebSocketFrame pong = new WebSocketFrame(WebSocketFrame.TYPE_PONG, payload.getBinary());
            this.send(MessageBuilder.withPayload(pong)
                .copyHeaders(message.getHeaders())
                .build());
          }
        }
        catch (Exception e) {
          throw new MessageHandlingException(message, "Send failed", e);
        }
      }
      else if (payload.getType() == WebSocketFrame.TYPE_PONG) {
        if (logger.isDebugEnabled()) {
          logger.debug("Pong received on " + this.getConnectionId());
        }
      }
      else if (this.shook) {
        return super.onMessage(message);
      }
      else {
        try {
          doHandshake(payload, message.getHeaders());
          this.shook = true;
          WebSocketEvent event = new WebSocketEvent(this.getTheConnection(),
              WebSocketEventType.HANDSHAKE_COMPLETE, state.getPath(), state.getQueryString());
          this.getTheConnection().publishEvent(event);
        }
        catch (Exception e) {
          throw new MessageHandlingException(message, "Handshake failed", e);
        }
      }
      return true;
    }
View Full Code Here

              .copyHeaders(message.getHeaders())
              .build());
        }
      }
      catch (Exception e) {
        throw new MessageHandlingException(message, "Send failed", e);
      }
    }
View Full Code Here

 
  protected void doWrite(Message<?> message) {
    try {
      hdfsWriter.write(message);
    } catch (Exception e) {
      throw new MessageHandlingException(message,
          "failed to write Message payload to HDFS", e);
    }
  }
View Full Code Here

    Path resultFile = new Path(destinationDirectoryToUse, generatedFileName);

    boolean resultFileExists = fsShell.test(resultFile.toUri().toString());

    if (FileExistsMode.FAIL.equals(this.fileExistsMode) && resultFileExists) {
      throw new MessageHandlingException(requestMessage,
          "The destination file already exists at '"
              + resultFile.toString() + "'.");
    }

    final boolean ignore = FileExistsMode.IGNORE
        .equals(this.fileExistsMode) && resultFileExists;

    if (!ignore) {

      try {
        if (payload instanceof File) {
          resultFile = this.handleFileMessage((File) payload,
              resultFile, resultFileExists);
        } else {
          throw new IllegalArgumentException(
              "unsupported Message payload type ["
                  + payload.getClass().getName() + "]");
        }
      } catch (Exception e) {
        throw new MessageHandlingException(requestMessage,
            "failed to write Message payload to file", e);
      }
    }

  }
View Full Code Here

    else if (payload instanceof String) {
      try {
        bytes = ((String) payload).getBytes(this.charset);
      }
      catch (UnsupportedEncodingException e) {
        throw new MessageHandlingException(message, e);
      }
    }
    else {
      throw new MessageHandlingException(message,
          "HdfsTextFileWriter expects " +
          "either a byte array or String payload, but received: " + payload.getClass());
    }
    return bytes;
  }
View Full Code Here

    Path resultFile = new Path(destinationDirectoryToUse, generatedFileName);

    boolean resultFileExists = fsShell.test(resultFile.toUri().toString());

    if (FileExistsMode.FAIL.equals(this.fileExistsMode) && resultFileExists) {
      throw new MessageHandlingException(requestMessage,
          "The destination file already exists at '"
              + resultFile.toString() + "'.");
    }

    final boolean ignore = FileExistsMode.IGNORE
        .equals(this.fileExistsMode) && resultFileExists;

    if (!ignore) {

      try {
        if (payload instanceof File) {
          resultFile = this.handleFileMessage((File) payload,
              resultFile, resultFileExists);
        } else {
          throw new IllegalArgumentException(
              "unsupported Message payload type ["
                  + payload.getClass().getName() + "]");
        }
      } catch (Exception e) {
        throw new MessageHandlingException(requestMessage,
            "failed to write Message payload to file", e);
      }
    }

    if (!this.expectReply) {
View Full Code Here

TOP

Related Classes of org.springframework.integration.MessageHandlingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.