本文整理了Java中org.apache.camel.Message.getHeaders()
方法的一些代码示例,展示了Message.getHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getHeaders()
方法的具体详情如下:
包路径:org.apache.camel.Message
类名称:Message
方法名:getHeaders
暂无
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
@Override
public <T> T evaluate(Exchange exchange, Class<T> type) {
return type.cast(exchange.getIn().getHeaders());
}
代码示例来源:origin: org.apache.camel/camel-routebox
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
in.getHeaders().putAll(headers);
in.setBody(body);
}
});
代码示例来源:origin: org.apache.camel/camel-beanstalk
protected Message getAnswerMessage(final Exchange exchange) {
Message answer = exchange.getIn();
if (ExchangeHelper.isOutCapable(exchange)) {
answer = exchange.getOut();
// preserve headers
answer.getHeaders().putAll(exchange.getIn().getHeaders());
}
return answer;
}
代码示例来源:origin: org.apache.camel/camel-rabbitmq
private Message resolveMessageFrom(final Exchange camelExchange) {
Message message = camelExchange.hasOut() ? camelExchange.getOut() : camelExchange.getIn();
// Remove the SERIALIZE_HEADER in case it was previously set
if (message.getHeaders() != null && message.getHeaders().containsKey(RabbitMQEndpoint.SERIALIZE_HEADER)) {
LOG.trace("Removing header: {}", RabbitMQEndpoint.SERIALIZE_HEADER);
message.getHeaders().remove(RabbitMQEndpoint.SERIALIZE_HEADER);
}
if (routingKey != null && routingKey.startsWith(RabbitMQConstants.RABBITMQ_DIRECT_REPLY_ROUTING_KEY)) {
message.setHeader(RabbitMQConstants.EXCHANGE_NAME, RabbitMQConstants.RABBITMQ_DIRECT_REPLY_EXCHANGE); // use default exchange for reply-to messages
message.setHeader(RabbitMQConstants.EXCHANGE_OVERRIDE_NAME, RabbitMQConstants.RABBITMQ_DIRECT_REPLY_EXCHANGE); // use default exchange for reply-to messages
}
return message;
}
代码示例来源:origin: at.researchstudio.sat/won-core
public void inspectHeaders(Exchange exchange){
Map headers = (Map) exchange.getIn().getHeaders();
Iterator iter = headers.entrySet().iterator();
if (logger.isDebugEnabled()) {
logger.debug("WIRETAP: headers size: "+headers.size());
while(iter.hasNext()){
Map.Entry pairs = (Map.Entry)iter.next();
if(pairs.getValue()!=null)
logger.debug("key: "+pairs.getKey()+" value: "+pairs.getValue());
}
}
}
代码示例来源:origin: opentelecoms-org/smsrouter
@Override
public boolean matches(Exchange exchange) {
Message message = exchange.getIn();
if(!message.getHeaders().containsKey(headerName)) {
return false;
}
String value = message.getHeader(headerName, String.class).toLowerCase();
if(tokens.contains(value)) {
logger.info("header '{}' value '{}' is blacklisted", headerName, value);
return true;
}
return false;
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
@Override
public <T> T evaluate(Exchange exchange, Class<T> type) {
Object[] result = new Object[2];
result [0] = exchange.getIn().getHeaders();
result [1] = MarkupBuilder.newInstance();
return type.cast(result);
}
代码示例来源:origin: ru.yandex.qatools.camelot/camelot-commons
@Override
public Exchange preProcess(Exchange exchange, ClassLoader classLoader) {
final Object body = exchange.getIn().getBody();
if (body != null) {
exchange.getIn().setBody(processBodyAndHeadersAfterReceive(body, exchange.getIn().getHeaders(), classLoader));
}
return exchange;
}
代码示例来源:origin: ru.yandex.qatools.camelot/camelot-commons
@Override
public Exchange postProcess(Exchange exchange, ClassLoader classLoader) {
final Object body = exchange.getIn().getBody();
if (body != null) {
exchange.getIn().setBody(processBodyAndHeadersBeforeSend(body, exchange.getIn().getHeaders(), classLoader));
}
return exchange;
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-fhir-pixpdq
/**
* Returns a processor for translating FHIR messages to Hl7v2
* using the given translator instance.
*/
public static Processor translatorFhirToHL7v2(final TranslatorFhirToHL7v2 translator) {
return exchange -> {
// ca.uhn.hl7v2.model.Message initial = exchange.getProperty(HL7V3_ORIGINAL_REQUEST_PROPERTY, ca.uhn.hl7v2.model.Message.class);
Object fhir = exchange.getIn().getBody();
Map<String, Object> parameters = exchange.getIn().getHeaders();
// exchange.setProperty(HL7V3_ORIGINAL_REQUEST_PROPERTY, xmlText);
org.apache.camel.Message resultMessage = Exchanges.resultMessage(exchange);
resultMessage.getHeaders().putAll(exchange.getIn().getHeaders());
resultMessage.setBody(translator.translateFhirToHL7v2(fhir, parameters));
};
}
代码示例来源:origin: org.apache.camel/camel-mail
/**
* Does the given camel message contain any To, CC or BCC header names?
*/
private static boolean hasRecipientHeaders(Exchange exchange) {
for (String key : exchange.getIn().getHeaders().keySet()) {
if (isRecipientHeader(key)) {
return true;
}
}
return false;
}
代码示例来源:origin: nz.ac.auckland.morc/morc
/**
* @param exchange The exchange containing the headers we need to validate
* @return true if each header in the test resource is in input; additional headers in the input will be ignored
*/
public boolean matches(Exchange exchange) {
Map<String, Object> value = exchange.getIn().getHeaders();
return matches(value);
}
代码示例来源:origin: org.apache.camel/camel-spring-integration
public static org.springframework.messaging.Message<?> createSpringIntegrationMessage(Exchange exchange) {
return createSpringIntegrationMessage(exchange, exchange.getIn().getHeaders());
}
代码示例来源:origin: org.apache.camel/camel-thrift
@Override
public void onComplete(Object response) {
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
if (response == null) {
exchange.getOut().setBody(response);
} else {
exchange.getOut().setBody(response, response.getClass());
}
callback.done(false);
}
代码示例来源:origin: at.researchstudio.sat/won-node
@Override
public void process(Exchange exchange) throws Exception {
logger.debug("processing messages for dynamic recipients generation");
Map headers = exchange.getIn().getHeaders();
Map properties = exchange.getProperties();
List<String> ownerApplications = (List<String>)headers.get(WonCamelConstants.OWNER_APPLICATIONS);
// String methodName =headers.get("methodName").toString();
logger.debug("number of registered owner applications: {}", ownerApplications == null ? 0 : ownerApplications.size());
List<String> queueNames = convertToQueueName(ownerApplications,"wonMessage",exchange);
exchange.getIn().setHeader("ownerApplicationIDs",queueNames);
}
private List<String> convertToQueueName(List<String> ownerApplications,String methodName,Exchange
代码示例来源:origin: org.apache.camel/camel-netty
public static void setOut(Exchange exchange, Object payload) {
if (payload instanceof DefaultExchangeHolder) {
DefaultExchangeHolder.unmarshal(exchange, (DefaultExchangeHolder) payload);
} else {
// normal transfer using the body only and preserve the headers
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
exchange.getOut().setBody(payload);
}
}
代码示例来源:origin: camelinaction/camelinaction2
public void process(Exchange exchange) throws Exception {
String input = exchange.getIn().getBody(String.class);
// if the verbose switch is turned on then log to System out
if (getEndpoint().isVerbose()) {
System.out.println("Calling ERP with: " + input);
}
// simulate calling ERP system and setting reply on the OUT body
exchange.getOut().setBody("Simulated response from ERP");
// support propagating headers (by copying headers from IN -> OUT)
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
}
代码示例来源:origin: camelinaction/camelinaction
public void process(Exchange exchange) throws Exception {
String input = exchange.getIn().getBody(String.class);
// if the verbose switch is turned on then log to System out
if (getEndpoint().isVerbose()) {
System.out.println("Calling ERP with: " + input);
}
// simulate calling ERP system and setting reply on the OUT body
exchange.getOut().setBody("Simulated response from ERP");
// support propagating headers (by copying headers from IN -> OUT)
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
}
代码示例来源:origin: com.googlecode.metridoc/metridoc-camel-core
@Override
@SuppressWarnings("unchecked")
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
oldExchange = new DefaultExchange(newExchange);
oldExchange.getIn().setHeaders(newExchange.getIn().getHeaders());
List<Object> body = new ArrayList<Object>();
oldExchange.getIn().setBody(body);
oldExchange.getExchangeId();
}
oldExchange.getIn().getBody(List.class).add(newExchange.getIn().getBody());
return oldExchange;
}
代码示例来源:origin: org.apache.camel/camel-olingo2
@Override
public void onResponse(Object response, Map<String, String> responseHeaders) {
// producer returns a single response, even for methods with List return types
exchange.getOut().setBody(response);
// copy headers
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
// Add http response headers
exchange.getOut().setHeader(Olingo2Constants.PROPERTY_PREFIX + RESPONSE_HTTP_HEADERS, responseHeaders);
interceptResult(response, exchange);
callback.done(false);
}
内容来源于网络,如有侵权,请联系作者删除!