Browse Source

Consistent nullability and exception declarations

Closes gh-35159
pull/35405/head
Juergen Hoeller 9 months ago
parent
commit
9596b70b2a
  1. 28
      spring-jms/src/main/java/org/springframework/jms/core/JmsMessageOperations.java
  2. 47
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractDestinationResolvingMessagingTemplate.java
  3. 28
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageReceivingTemplate.java
  4. 15
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageSendingTemplate.java
  5. 35
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessagingTemplate.java
  6. 8
      spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageRequestReplyOperations.java
  7. 8
      spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageSendingOperations.java
  8. 12
      spring-messaging/src/main/java/org/springframework/messaging/core/MessageRequestReplyOperations.java
  9. 16
      spring-messaging/src/main/java/org/springframework/messaging/core/MessageSendingOperations.java

28
spring-jms/src/main/java/org/springframework/jms/core/JmsMessageOperations.java

@ -30,8 +30,12 @@ import org.springframework.messaging.core.MessageSendingOperations;
/** /**
* A specialization of {@link MessageSendingOperations}, {@link MessageReceivingOperations} * A specialization of {@link MessageSendingOperations}, {@link MessageReceivingOperations}
* and {@link MessageRequestReplyOperations} for JMS related operations that allow to specify * and {@link MessageRequestReplyOperations} for JMS related operations that allow to
* a destination name rather than the actual {@link jakarta.jms.Destination}. * specify a destination name rather than the actual {@link jakarta.jms.Destination}.
*
* <p>Note: Operations in this interface throw {@link MessagingException} instead of
* the JMS-specific {@link org.springframework.jms.JmsException}, aligning with the
* {@code spring-messaging} module and its other client operation handles.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 4.1 * @since 4.1
@ -68,30 +72,30 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
*/ */
void convertAndSend(String destinationName, Object payload, Map<String, Object> headers) void convertAndSend(String destinationName, Object payload, @Nullable Map<String, Object> headers)
throws MessagingException; throws MessagingException;
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message, apply the given post processor, and send * wrap it as a message, apply the given post-processor, and send
* the resulting message to the given destination. * the resulting message to the given destination.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
void convertAndSend(String destinationName, Object payload, MessagePostProcessor postProcessor) void convertAndSend(String destinationName, Object payload, @Nullable MessagePostProcessor postProcessor)
throws MessagingException; throws MessagingException;
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post processor, * wrap it as a message with the given headers, apply the given post-processor,
* and send the resulting message to the given destination. * and send the resulting message to the given destination.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
void convertAndSend(String destinationName, Object payload, @Nullable Map<String, Object> headers, void convertAndSend(String destinationName, Object payload, @Nullable Map<String, Object> headers,
@Nullable MessagePostProcessor postProcessor) throws MessagingException; @Nullable MessagePostProcessor postProcessor) throws MessagingException;
@ -159,13 +163,13 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
/** /**
* Convert the given request Object to serialized form, possibly using a * Convert the given request Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* apply the given post processor and send the resulting {@link Message} to the * apply the given post-processor and send the resulting {@link Message} to the
* given destination, receive the reply and convert its body of the given * given destination, receive the reply and convert its body of the given
* target class. * target class.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param request payload for the request message to send * @param request payload for the request message to send
* @param targetClass the target type to convert the payload of the reply to * @param targetClass the target type to convert the payload of the reply to
* @param requestPostProcessor post process to apply to the request message * @param requestPostProcessor post-process to apply to the request message
* @return the payload of the reply message, possibly {@code null} if the message * @return the payload of the reply message, possibly {@code null} if the message
* could not be received, for example due to a timeout * could not be received, for example due to a timeout
*/ */
@ -176,13 +180,13 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
/** /**
* Convert the given request Object to serialized form, possibly using a * Convert the given request Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post processor * wrap it as a message with the given headers, apply the given post-processor
* and send the resulting {@link Message} to the specified destination, receive * and send the resulting {@link Message} to the specified destination, receive
* the reply and convert its body of the given target class. * the reply and convert its body of the given target class.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param request payload for the request message to send * @param request payload for the request message to send
* @param targetClass the target type to convert the payload of the reply to * @param targetClass the target type to convert the payload of the reply to
* @param requestPostProcessor post process to apply to the request message * @param requestPostProcessor post-process to apply to the request message
* @return the payload of the reply message, possibly {@code null} if the message * @return the payload of the reply message, possibly {@code null} if the message
* could not be received, for example due to a timeout * could not be received, for example due to a timeout
*/ */

47
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractDestinationResolvingMessagingTemplate.java

@ -20,6 +20,7 @@ import java.util.Map;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
@ -65,37 +66,41 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
return this.destinationResolver; return this.destinationResolver;
} }
protected final D resolveDestination(String destinationName) throws DestinationResolutionException {
Assert.state(this.destinationResolver != null,
"DestinationResolver is required to resolve destination names");
return this.destinationResolver.resolveDestination(destinationName);
}
@Override @Override
public void send(String destinationName, Message<?> message) { public void send(String destinationName, Message<?> message) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
doSend(destination, message); doSend(destination, message);
} }
protected final D resolveDestination(String destinationName) {
Assert.state(this.destinationResolver != null, "DestinationResolver is required to resolve destination names");
return this.destinationResolver.resolveDestination(destinationName);
}
@Override @Override
public <T> void convertAndSend(String destinationName, T payload) { public <T> void convertAndSend(String destinationName, T payload) throws MessagingException {
convertAndSend(destinationName, payload, null, null); convertAndSend(destinationName, payload, null, null);
} }
@Override @Override
public <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers) { public <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers)
throws MessagingException {
convertAndSend(destinationName, payload, headers, null); convertAndSend(destinationName, payload, headers, null);
} }
@Override @Override
public <T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor) { public <T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor)
throws MessagingException {
convertAndSend(destinationName, payload, null, postProcessor); convertAndSend(destinationName, payload, null, postProcessor);
} }
@Override @Override
public <T> void convertAndSend(String destinationName, T payload, public <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers,
@Nullable Map<String, Object> headers, @Nullable MessagePostProcessor postProcessor) { @Nullable MessagePostProcessor postProcessor) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
super.convertAndSend(destination, payload, headers, postProcessor); super.convertAndSend(destination, payload, headers, postProcessor);
@ -103,28 +108,32 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
@Override @Override
@Nullable @Nullable
public Message<?> receive(String destinationName) { public Message<?> receive(String destinationName) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.receive(destination); return super.receive(destination);
} }
@Override @Override
@Nullable @Nullable
public <T> T receiveAndConvert(String destinationName, Class<T> targetClass) { public <T> T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.receiveAndConvert(destination, targetClass); return super.receiveAndConvert(destination, targetClass);
} }
@Override @Override
@Nullable @Nullable
public Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) { public Message<?> sendAndReceive(String destinationName, Message<?> requestMessage)
throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.sendAndReceive(destination, requestMessage); return super.sendAndReceive(destination, requestMessage);
} }
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass) { public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, targetClass); return super.convertSendAndReceive(destination, request, targetClass);
} }
@ -132,7 +141,7 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(String destinationName, Object request, public <T> T convertSendAndReceive(String destinationName, Object request,
@Nullable Map<String, Object> headers, Class<T> targetClass) { @Nullable Map<String, Object> headers, Class<T> targetClass) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, headers, targetClass); return super.convertSendAndReceive(destination, request, headers, targetClass);
@ -141,7 +150,7 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass, public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
@Nullable MessagePostProcessor postProcessor) { @Nullable MessagePostProcessor postProcessor) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, targetClass, postProcessor); return super.convertSendAndReceive(destination, request, targetClass, postProcessor);
@ -151,7 +160,7 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
@Nullable @Nullable
public <T> T convertSendAndReceive(String destinationName, Object request, public <T> T convertSendAndReceive(String destinationName, Object request,
@Nullable Map<String, Object> headers, Class<T> targetClass, @Nullable Map<String, Object> headers, Class<T> targetClass,
@Nullable MessagePostProcessor postProcessor) { @Nullable MessagePostProcessor postProcessor) throws MessagingException {
D destination = resolveDestination(destinationName); D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, headers, targetClass, postProcessor); return super.convertSendAndReceive(destination, request, headers, targetClass, postProcessor);

28
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageReceivingTemplate.java

@ -18,6 +18,7 @@ package org.springframework.messaging.core;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.converter.MessageConversionException; import org.springframework.messaging.converter.MessageConversionException;
import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.converter.MessageConverter;
@ -36,35 +37,25 @@ public abstract class AbstractMessageReceivingTemplate<D> extends AbstractMessag
@Override @Override
@Nullable @Nullable
public Message<?> receive() { public Message<?> receive() throws MessagingException {
return doReceive(getRequiredDefaultDestination()); return doReceive(getRequiredDefaultDestination());
} }
@Override @Override
@Nullable @Nullable
public Message<?> receive(D destination) { public Message<?> receive(D destination) throws MessagingException {
return doReceive(destination); return doReceive(destination);
} }
/**
* Actually receive a message from the given destination.
* @param destination the target destination
* @return the received message, possibly {@code null} if the message could not
* be received, for example due to a timeout
*/
@Nullable
protected abstract Message<?> doReceive(D destination);
@Override @Override
@Nullable @Nullable
public <T> T receiveAndConvert(Class<T> targetClass) { public <T> T receiveAndConvert(Class<T> targetClass) throws MessagingException {
return receiveAndConvert(getRequiredDefaultDestination(), targetClass); return receiveAndConvert(getRequiredDefaultDestination(), targetClass);
} }
@Override @Override
@Nullable @Nullable
public <T> T receiveAndConvert(D destination, Class<T> targetClass) { public <T> T receiveAndConvert(D destination, Class<T> targetClass) throws MessagingException {
Message<?> message = doReceive(destination); Message<?> message = doReceive(destination);
if (message != null) { if (message != null) {
return doConvert(message, targetClass); return doConvert(message, targetClass);
@ -92,4 +83,13 @@ public abstract class AbstractMessageReceivingTemplate<D> extends AbstractMessag
return value; return value;
} }
/**
* Actually receive a message from the given destination.
* @param destination the target destination
* @return the received message, possibly {@code null} if the
* message could not be received, for example due to a timeout
*/
@Nullable
protected abstract Message<?> doReceive(D destination);
} }

15
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageSendingTemplate.java

@ -109,9 +109,6 @@ public abstract class AbstractMessageSendingTemplate<D> implements MessageSendin
doSend(destination, message); doSend(destination, message);
} }
protected abstract void doSend(D destination, Message<?> message);
@Override @Override
public void convertAndSend(Object payload) throws MessagingException { public void convertAndSend(Object payload) throws MessagingException {
convertAndSend(payload, null); convertAndSend(payload, null);
@ -151,13 +148,14 @@ public abstract class AbstractMessageSendingTemplate<D> implements MessageSendin
send(destination, message); send(destination, message);
} }
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link MessageConverter}, wrap it as a message with the given * {@link MessageConverter}, wrap it as a message with the given
* headers and apply the given post processor. * headers and apply the given post-processor.
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
* @return the converted message * @return the converted message
*/ */
protected Message<?> doConvert(Object payload, @Nullable Map<String, Object> headers, protected Message<?> doConvert(Object payload, @Nullable Map<String, Object> headers,
@ -199,4 +197,11 @@ public abstract class AbstractMessageSendingTemplate<D> implements MessageSendin
return headers; return headers;
} }
/**
* Actually send the given message to the given destination.
* @param destination the target destination
* @param message the message to send
*/
protected abstract void doSend(D destination, Message<?> message);
} }

35
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessagingTemplate.java

@ -20,6 +20,7 @@ import java.util.Map;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
/** /**
* An extension of {@link AbstractMessageReceivingTemplate} that adds support for * An extension of {@link AbstractMessageReceivingTemplate} that adds support for
@ -36,36 +37,33 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv
@Override @Override
@Nullable @Nullable
public Message<?> sendAndReceive(Message<?> requestMessage) { public Message<?> sendAndReceive(Message<?> requestMessage) throws MessagingException {
return sendAndReceive(getRequiredDefaultDestination(), requestMessage); return sendAndReceive(getRequiredDefaultDestination(), requestMessage);
} }
@Override @Override
@Nullable @Nullable
public Message<?> sendAndReceive(D destination, Message<?> requestMessage) { public Message<?> sendAndReceive(D destination, Message<?> requestMessage) throws MessagingException {
return doSendAndReceive(destination, requestMessage); return doSendAndReceive(destination, requestMessage);
} }
@Nullable
protected abstract Message<?> doSendAndReceive(D destination, Message<?> requestMessage);
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(Object request, Class<T> targetClass) { public <T> T convertSendAndReceive(Object request, Class<T> targetClass) throws MessagingException {
return convertSendAndReceive(getRequiredDefaultDestination(), request, targetClass); return convertSendAndReceive(getRequiredDefaultDestination(), request, targetClass);
} }
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(D destination, Object request, Class<T> targetClass) { public <T> T convertSendAndReceive(D destination, Object request, Class<T> targetClass) throws MessagingException {
return convertSendAndReceive(destination, request, null, targetClass); return convertSendAndReceive(destination, request, null, targetClass);
} }
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive( public <T> T convertSendAndReceive(
D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass) { D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass)
throws MessagingException {
return convertSendAndReceive(destination, request, headers, targetClass, null); return convertSendAndReceive(destination, request, headers, targetClass, null);
} }
@ -73,7 +71,8 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive( public <T> T convertSendAndReceive(
Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) { Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor)
throws MessagingException {
return convertSendAndReceive(getRequiredDefaultDestination(), request, targetClass, postProcessor); return convertSendAndReceive(getRequiredDefaultDestination(), request, targetClass, postProcessor);
} }
@ -81,7 +80,7 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(D destination, Object request, Class<T> targetClass, public <T> T convertSendAndReceive(D destination, Object request, Class<T> targetClass,
@Nullable MessagePostProcessor postProcessor) { @Nullable MessagePostProcessor postProcessor) throws MessagingException {
return convertSendAndReceive(destination, request, null, targetClass, postProcessor); return convertSendAndReceive(destination, request, null, targetClass, postProcessor);
} }
@ -90,11 +89,23 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv
@Override @Override
@Nullable @Nullable
public <T> T convertSendAndReceive(D destination, Object request, @Nullable Map<String, Object> headers, public <T> T convertSendAndReceive(D destination, Object request, @Nullable Map<String, Object> headers,
Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) { Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) throws MessagingException {
Message<?> requestMessage = doConvert(request, headers, postProcessor); Message<?> requestMessage = doConvert(request, headers, postProcessor);
Message<?> replyMessage = sendAndReceive(destination, requestMessage); Message<?> replyMessage = sendAndReceive(destination, requestMessage);
return (replyMessage != null ? (T) getMessageConverter().fromMessage(replyMessage, targetClass) : null); return (replyMessage != null ? (T) getMessageConverter().fromMessage(replyMessage, targetClass) : null);
} }
/**
* Actually send the given request message to the given destination and
* receive a reply message for it.
* @param destination the target destination
* @param requestMessage the message to send
* @return the received reply, possibly {@code null} if the
* message could not be received, for example due to a timeout
*/
@Nullable
protected abstract Message<?> doSendAndReceive(D destination, Message<?> requestMessage);
} }

8
spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageRequestReplyOperations.java

@ -82,13 +82,13 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me
* Resolve the given destination name, convert the payload request Object * Resolve the given destination name, convert the payload request Object
* to serialized form, possibly using a * to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message, apply the given post process, and send the resulting * wrap it as a message, apply the given post-process, and send the resulting
* message to the resolved destination, then receive a reply and convert its * message to the resolved destination, then receive a reply and convert its
* body to the specified target class. * body to the specified target class.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param request the payload for the request message to send * @param request the payload for the request message to send
* @param targetClass the target class to convert the payload of the reply to * @param targetClass the target class to convert the payload of the reply to
* @param requestPostProcessor post process for the request message * @param requestPostProcessor post-process for the request message
* @return the converted payload of the reply message, possibly {@code null} if * @return the converted payload of the reply message, possibly {@code null} if
* the message could not be received, for example due to a timeout * the message could not be received, for example due to a timeout
*/ */
@ -100,14 +100,14 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me
* Resolve the given destination name, convert the payload request Object * Resolve the given destination name, convert the payload request Object
* to serialized form, possibly using a * to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post process, * wrap it as a message with the given headers, apply the given post-process,
* and send the resulting message to the resolved destination, then receive * and send the resulting message to the resolved destination, then receive
* a reply and convert its body to the specified target class. * a reply and convert its body to the specified target class.
* @param destinationName the name of the target destination * @param destinationName the name of the target destination
* @param request the payload for the request message to send * @param request the payload for the request message to send
* @param headers the headers for the request message to send * @param headers the headers for the request message to send
* @param targetClass the target class to convert the payload of the reply to * @param targetClass the target class to convert the payload of the reply to
* @param requestPostProcessor post process for the request message * @param requestPostProcessor post-process for the request message
* @return the converted payload of the reply message, possibly {@code null} if * @return the converted payload of the reply message, possibly {@code null} if
* the message could not be received, for example due to a timeout * the message could not be received, for example due to a timeout
*/ */

8
spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageSendingOperations.java

@ -68,11 +68,11 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message
* Resolve the given destination name to a destination, convert the payload * Resolve the given destination name to a destination, convert the payload
* Object to serialized form, possibly using a * Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message, apply the given post processor, and send the resulting * wrap it as a message, apply the given post-processor, and send the resulting
* message to the resolved destination. * message to the resolved destination.
* @param destinationName the destination name to resolve * @param destinationName the destination name to resolve
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
<T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor) <T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor)
throws MessagingException; throws MessagingException;
@ -81,12 +81,12 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message
* Resolve the given destination name to a destination, convert the payload * Resolve the given destination name to a destination, convert the payload
* Object to serialized form, possibly using a * Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post processor, * wrap it as a message with the given headers, apply the given post-processor,
* and send the resulting message to the resolved destination. * and send the resulting message to the resolved destination.
* @param destinationName the destination name to resolve * @param destinationName the destination name to resolve
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
<T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers, <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers,
@Nullable MessagePostProcessor postProcessor) throws MessagingException; @Nullable MessagePostProcessor postProcessor) throws MessagingException;

12
spring-messaging/src/main/java/org/springframework/messaging/core/MessageRequestReplyOperations.java

@ -99,12 +99,12 @@ public interface MessageRequestReplyOperations<D> {
/** /**
* Convert the given request Object to serialized form, possibly using a * Convert the given request Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* apply the given post processor and send the resulting {@link Message} to a * apply the given post-processor and send the resulting {@link Message} to a
* default destination, receive the reply and convert its body of the given * default destination, receive the reply and convert its body of the given
* target class. * target class.
* @param request payload for the request message to send * @param request payload for the request message to send
* @param targetClass the target type to convert the payload of the reply to * @param targetClass the target type to convert the payload of the reply to
* @param requestPostProcessor post process to apply to the request message * @param requestPostProcessor post-process to apply to the request message
* @return the payload of the reply message, possibly {@code null} if the message * @return the payload of the reply message, possibly {@code null} if the message
* could not be received, for example due to a timeout * could not be received, for example due to a timeout
*/ */
@ -116,13 +116,13 @@ public interface MessageRequestReplyOperations<D> {
/** /**
* Convert the given request Object to serialized form, possibly using a * Convert the given request Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* apply the given post processor and send the resulting {@link Message} to the * apply the given post-processor and send the resulting {@link Message} to the
* given destination, receive the reply and convert its body of the given * given destination, receive the reply and convert its body of the given
* target class. * target class.
* @param destination the target destination * @param destination the target destination
* @param request payload for the request message to send * @param request payload for the request message to send
* @param targetClass the target type to convert the payload of the reply to * @param targetClass the target type to convert the payload of the reply to
* @param requestPostProcessor post process to apply to the request message * @param requestPostProcessor post-process to apply to the request message
* @return the payload of the reply message, possibly {@code null} if the message * @return the payload of the reply message, possibly {@code null} if the message
* could not be received, for example due to a timeout * could not be received, for example due to a timeout
*/ */
@ -133,13 +133,13 @@ public interface MessageRequestReplyOperations<D> {
/** /**
* Convert the given request Object to serialized form, possibly using a * Convert the given request Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post processor * wrap it as a message with the given headers, apply the given post-processor
* and send the resulting {@link Message} to the specified destination, receive * and send the resulting {@link Message} to the specified destination, receive
* the reply and convert its body of the given target class. * the reply and convert its body of the given target class.
* @param destination the target destination * @param destination the target destination
* @param request payload for the request message to send * @param request payload for the request message to send
* @param targetClass the target type to convert the payload of the reply to * @param targetClass the target type to convert the payload of the reply to
* @param requestPostProcessor post process to apply to the request message * @param requestPostProcessor post-process to apply to the request message
* @return the payload of the reply message, possibly {@code null} if the message * @return the payload of the reply message, possibly {@code null} if the message
* could not be received, for example due to a timeout * could not be received, for example due to a timeout
*/ */

16
spring-messaging/src/main/java/org/springframework/messaging/core/MessageSendingOperations.java

@ -71,38 +71,38 @@ public interface MessageSendingOperations<D> {
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
*/ */
void convertAndSend(D destination, Object payload, Map<String, Object> headers) throws MessagingException; void convertAndSend(D destination, Object payload, @Nullable Map<String, Object> headers) throws MessagingException;
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message, apply the given post processor, and send * wrap it as a message, apply the given post-processor, and send
* the resulting message to a default destination. * the resulting message to a default destination.
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
void convertAndSend(Object payload, @Nullable MessagePostProcessor postProcessor) throws MessagingException; void convertAndSend(Object payload, @Nullable MessagePostProcessor postProcessor) throws MessagingException;
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message, apply the given post processor, and send * wrap it as a message, apply the given post-processor, and send
* the resulting message to the given destination. * the resulting message to the given destination.
* @param destination the target destination * @param destination the target destination
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
void convertAndSend(D destination, Object payload, MessagePostProcessor postProcessor) throws MessagingException; void convertAndSend(D destination, Object payload, @Nullable MessagePostProcessor postProcessor) throws MessagingException;
/** /**
* Convert the given Object to serialized form, possibly using a * Convert the given Object to serialized form, possibly using a
* {@link org.springframework.messaging.converter.MessageConverter}, * {@link org.springframework.messaging.converter.MessageConverter},
* wrap it as a message with the given headers, apply the given post processor, * wrap it as a message with the given headers, apply the given post-processor,
* and send the resulting message to the given destination. * and send the resulting message to the given destination.
* @param destination the target destination * @param destination the target destination
* @param payload the Object to use as payload * @param payload the Object to use as payload
* @param headers the headers for the message to send * @param headers the headers for the message to send
* @param postProcessor the post processor to apply to the message * @param postProcessor the post-processor to apply to the message
*/ */
void convertAndSend(D destination, Object payload, @Nullable Map<String, Object> headers, void convertAndSend(D destination, Object payload, @Nullable Map<String, Object> headers,
@Nullable MessagePostProcessor postProcessor) throws MessagingException; @Nullable MessagePostProcessor postProcessor) throws MessagingException;

Loading…
Cancel
Save