org.springframework.integration.support.AbstractIntegrationMessageBuilder.removeHeaders()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.springframework.integration.support.AbstractIntegrationMessageBuilder.removeHeaders()方法的一些代码示例,展示了AbstractIntegrationMessageBuilder.removeHeaders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractIntegrationMessageBuilder.removeHeaders()方法的具体详情如下:
包路径:org.springframework.integration.support.AbstractIntegrationMessageBuilder
类名称:AbstractIntegrationMessageBuilder
方法名:removeHeaders

AbstractIntegrationMessageBuilder.removeHeaders介绍

[英]Removes all headers provided via array of 'headerPatterns'. As the name suggests the array may contain simple matching patterns for header names. Supported pattern styles are: "xxx*", "xxx", "xxx" and "xxxyyy".
[中]删除通过“headerPatterns”数组提供的所有标头。顾名思义,数组可能包含头名称的简单匹配模式。支持的图案样式有:“xxx*”、“xxx”、“xxx”和“xxx*yyy”。

代码示例

代码示例来源:origin: spring-projects/spring-integration

@Override
protected Object doTransform(Message<?> message) throws Exception {
  if (this.targetClass != null) {
    return this.jsonObjectMapper.fromJson(message.getPayload(), this.targetClass);
  }
  else {
    Object result = this.jsonObjectMapper.fromJson(message.getPayload(), message.getHeaders());
    AbstractIntegrationMessageBuilder<Object> messageBuilder = this.getMessageBuilderFactory().withPayload(result)
        .copyHeaders(message.getHeaders())
        .removeHeaders(JsonHeaders.HEADERS.toArray(new String[3]));
    return messageBuilder.build();
  }
}

代码示例来源:origin: spring-projects/spring-integration

@Override
public Message<?> transform(Message<?> message) {
  AbstractIntegrationMessageBuilder<?> builder = this.getMessageBuilderFactory().fromMessage(message);
  if (this.patternMatch) {
    builder.removeHeaders(this.headersToRemove);
  }
  else {
    for (String headerToRemove : this.headersToRemove) {
      builder.removeHeader(headerToRemove);
    }
  }
  return builder.build();
}

代码示例来源:origin: org.springframework.integration/spring-integration-core

@Override
protected Object doTransform(Message<?> message) throws Exception {
  if (this.targetClass != null) {
    return this.jsonObjectMapper.fromJson(message.getPayload(), this.targetClass);
  }
  else {
    Object result = this.jsonObjectMapper.fromJson(message.getPayload(), message.getHeaders());
    AbstractIntegrationMessageBuilder<Object> messageBuilder = this.getMessageBuilderFactory().withPayload(result)
        .copyHeaders(message.getHeaders())
        .removeHeaders(JsonHeaders.HEADERS.toArray(new String[3]));
    return messageBuilder.build();
  }
}

代码示例来源:origin: org.springframework.integration/spring-integration-core

@Override
public Message<?> transform(Message<?> message) {
  AbstractIntegrationMessageBuilder<?> builder = this.getMessageBuilderFactory().fromMessage(message);
  if (this.patternMatch) {
    builder.removeHeaders(this.headersToRemove);
  }
  else {
    for (String headerToRemove : this.headersToRemove) {
      builder.removeHeader(headerToRemove);
    }
  }
  return builder.build();
}

代码示例来源:origin: org.springframework.integration/spring-integration-aws

@Override
protected void handleMessageInternal(Message<?> message, String lookupDestination) {
  MessageHeaders headers = message.getHeaders();
  Message<?> messageToSend = getMessageBuilderFactory()
      .fromMessage(message)
      .removeHeaders("LogicalResourceId",
          "MessageId",
          "ReceiptHandle",
          "Acknowledgment")
      .setHeader(AwsHeaders.MESSAGE_ID, headers.get("MessageId"))
      .setHeader(AwsHeaders.RECEIPT_HANDLE, headers.get("ReceiptHandle"))
      .setHeader(AwsHeaders.RECEIVED_QUEUE, headers.get("LogicalResourceId"))
      .setHeader(AwsHeaders.ACKNOWLEDGMENT, headers.get("Acknowledgment"))
      .build();
  sendMessage(messageToSend);
}

代码示例来源:origin: spring-projects/spring-integration-aws

@Override
protected void handleMessageInternal(Message<?> message, String lookupDestination) {
  MessageHeaders headers = message.getHeaders();
  Message<?> messageToSend = getMessageBuilderFactory()
      .fromMessage(message)
      .removeHeaders("LogicalResourceId",
          "MessageId",
          "ReceiptHandle",
          "Acknowledgment")
      .setHeader(AwsHeaders.MESSAGE_ID, headers.get("MessageId"))
      .setHeader(AwsHeaders.RECEIPT_HANDLE, headers.get("ReceiptHandle"))
      .setHeader(AwsHeaders.RECEIVED_QUEUE, headers.get("LogicalResourceId"))
      .setHeader(AwsHeaders.ACKNOWLEDGMENT, headers.get("Acknowledgment"))
      .build();
  sendMessage(messageToSend);
}

相关文章