MessageChannel declares send(Message) as default method

Issue: SPR-14854
master
Juergen Hoeller 8 years ago
parent 37ce56fe96
commit dbaafdd04e
  1. 9
      spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,12 +22,13 @@ package org.springframework.messaging;
* @author Mark Fisher * @author Mark Fisher
* @since 4.0 * @since 4.0
*/ */
@FunctionalInterface
public interface MessageChannel { public interface MessageChannel {
/** /**
* Constant for sending a message without a prescribed timeout. * Constant for sending a message without a prescribed timeout.
*/ */
public static final long INDEFINITE_TIMEOUT = -1; long INDEFINITE_TIMEOUT = -1;
/** /**
@ -40,7 +41,9 @@ public interface MessageChannel {
* @param message the message to send * @param message the message to send
* @return whether or not the message was sent * @return whether or not the message was sent
*/ */
boolean send(Message<?> message); default boolean send(Message<?> message) {
return send(message, INDEFINITE_TIMEOUT);
}
/** /**
* Send a message, blocking until either the message is accepted or the * Send a message, blocking until either the message is accepted or the

Loading…
Cancel
Save