本文整理了Java中org.springframework.messaging.handler.annotation.Header
类的一些代码示例,展示了Header
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header
类的具体详情如下:
包路径:org.springframework.messaging.handler.annotation.Header
类名称:Header
暂无
代码示例来源:origin: spring-projects/spring-integration-samples
public void process(String thing, @Header(FileHeaders.FILENAME) String fileName);
代码示例来源:origin: spring-projects/spring-framework
private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue());
}
}
代码示例来源:origin: spring-projects/spring-framework
public void handleMessage(
@Header String param1,
@Header(name = "name", defaultValue = "bar") String param2,
@Header(name = "name", defaultValue = "#{systemProperties.systemProperty}") String param3,
@Header(name = "#{systemProperties.systemProperty}") String param4,
String param5,
@Header("foo") Optional<String> param6,
@Header("nativeHeaders.param1") String nativeHeaderParam1) {
}
代码示例来源:origin: org.springframework/spring-messaging
private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue());
}
}
代码示例来源:origin: spring-projects/spring-integration-samples
/**
* Aggregates LoanQuote Messages to return a single reply Message.
*
* @param quotes list of loan quotes received from upstream lenders
* @param responseType header that indicates the response type
* @return the best {@link LoanQuote} if the 'RESPONSE_TYPE' header value is 'BEST' else all quotes
*/
public Object aggregateQuotes(List<LoanQuote> quotes,
@Header(value="RESPONSE_TYPE", required=false) String responseType) {
Collections.sort(quotes);
return ("BEST".equals(responseType)) ? quotes.get(0) : quotes;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-messaging
private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue());
}
}
代码示例来源:origin: dyc87112/SpringCloud-Learning
@StreamListener(value = TestTopic.INPUT, condition = "headers['version']=='2.0'")
public void receiveV2(String payload, @Header("version") String version) {
log.info("Received v2 : " + payload + ", " + version);
}
代码示例来源:origin: apache/servicemix-bundles
private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue());
}
}
代码示例来源:origin: dyc87112/SpringCloud-Learning
@StreamListener(value = TestTopic.INPUT, condition = "headers['version']=='1.0'")
public void receiveV1(String payload, @Header("version") String version) {
log.info("Received v1 : " + payload + ", " + version);
}
代码示例来源:origin: spring-projects/spring-batch
public ChunkResponse extract(ChunkResponse input, @Header(JmsHeaders.REDELIVERED) boolean redelivered) {
if (logger.isDebugEnabled()) {
logger.debug("Extracted redelivered flag for response, value="+redelivered);
}
return new ChunkResponse(input, redelivered);
}
代码示例来源:origin: spring-projects/spring-framework
@MessageMapping("/optionalHeaders")
public void optionalHeaders(@Header(name="foo", required=false) String foo1, @Header("foo") Optional<String> foo2) {
this.method = "optionalHeaders";
this.arguments.put("foo1", foo1);
this.arguments.put("foo2", (foo2.isPresent() ? foo2.get() : null));
}
代码示例来源:origin: spring-projects/spring-integration-samples
/**
* If this service receives a payload 'failnnn' where nnn is the number of failures,
* it will fail that many times for a given message id.
* @param payload
* @param id
*/
public void testRetry(String payload, @Header("failingId") String id) {
if (payload.startsWith("fail")) {
int failHowManyTimes = Integer.parseInt(payload.substring(4).trim());
AtomicInteger failures = failCount.get(id);
if (failures == null) {
failures = new AtomicInteger();
failCount.put(id, failures);
}
int currentFailures = failures.incrementAndGet();
if (currentFailures <= failHowManyTimes) {
String message = "Failure " + currentFailures + " of " + failHowManyTimes;
logger.info("Service failure " + message);
throw new RuntimeException(message);
}
}
logger.info("Service success for " + payload);
failCount.remove(id);
}
代码示例来源:origin: spring-projects/spring-framework
void handleIt(@Payload String msg, @Header("my-header") String myHeader);
}
代码示例来源:origin: spring-projects/spring-framework
@MessageMapping("/headers")
public void headers(@Header String foo, @Headers Map<String, Object> headers) {
this.method = "headers";
this.arguments.put("foo", foo);
this.arguments.put("headers", headers);
}
代码示例来源:origin: spring-projects/spring-framework
@Transactional
@JmsListener(destination = "testQueue")
@SendTo("foobar")
public void handleIt(@Header String value, String body) {
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
@Transactional
@JmsListener(destination = "testQueue")
@SendTo("foobar")
public void handleIt(@Header String value, String body) {
}
}
代码示例来源:origin: spring-projects/spring-framework
public void resolveCustomHeaderNameAndPayload(@Payload String content, @Header("myCounter") int counter) {
this.invocations.put("resolveCustomHeaderNameAndPayload", true);
assertEquals("Wrong @Payload resolution", "my payload", content);
assertEquals("Wrong @Header resolution", 24, counter);
}
代码示例来源:origin: spring-projects/spring-framework
public void resolveCustomHeaderNameAndPayloadWithHeaderNameSet(@Payload String content, @Header(name = "myCounter") int counter) {
this.invocations.put("resolveCustomHeaderNameAndPayloadWithHeaderNameSet", true);
assertEquals("Wrong @Payload resolution", "my payload", content);
assertEquals("Wrong @Header resolution", 24, counter);
}
代码示例来源:origin: spring-projects/spring-framework
public void resolveHeaderAndPayload(@Payload String content, @Header int myCounter) {
this.invocations.put("resolveHeaderAndPayload", true);
assertEquals("Wrong @Payload resolution", "my payload", content);
assertEquals("Wrong @Header resolution", 55, myCounter);
}
代码示例来源:origin: spring-projects/spring-framework
public void handleIt(@Payload String msg, @Header("my-header") String myHeader) {
invocations.put("handleIt", true);
assertEquals("Unexpected payload message", "FOO-BAR", msg);
assertEquals("Unexpected header value", "my-value", myHeader);
}
}
内容来源于网络,如有侵权,请联系作者删除!