1 /* 2 * Copyright 2002-2018 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 module hunt.stomp.core.MessageReceivingOperations; 18 19 import hunt.Nullable; 20 import hunt.stomp.Message; 21 import hunt.stomp.MessagingException; 22 23 /** 24 * Operations for receiving messages from a destination. 25 * 26 * @author Mark Fisher 27 * @author Rossen Stoyanchev 28 * @since 4.0 29 * @param (T) the type of destination 30 * @see GenericMessagingTemplate 31 */ 32 interface MessageReceivingOperations(T) { 33 34 /** 35 * Receive a message from a default destination. 36 * @return the received message, possibly {@code null} if the message could not 37 * be received, for example due to a timeout 38 */ 39 40 Message!(T) receive(); 41 42 /** 43 * Receive a message from the given destination. 44 * @param destination the target destination 45 * @return the received message, possibly {@code null} if the message could not 46 * be received, for example due to a timeout 47 */ 48 49 Message!(T) receive(T destination); 50 51 /** 52 * Receive a message from a default destination and convert its payload to the 53 * specified target class. 54 * @param targetClass the target class to convert the payload to 55 * @return the converted payload of the reply message, possibly {@code null} if 56 * the message could not be received, for example due to a timeout 57 */ 58 59 // <T> T receiveAndConvert(Class!(T) targetClass); 60 61 /** 62 * Receive a message from the given destination and convert its payload to the 63 * specified target class. 64 * @param destination the target destination 65 * @param targetClass the target class to convert the payload to 66 * @return the converted payload of the reply message, possibly {@code null} if 67 * the message could not be received, for example due to a timeout 68 */ 69 70 // <T> T receiveAndConvert(T destination, Class!(T) targetClass); 71 72 }