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.DestinationResolvingMessageRequestReplyOperations;
18 
19 import hunt.collection.Map;
20 
21 import hunt.stomp.core.MessageRequestReplyOperations;
22 import hunt.stomp.Message;
23 import hunt.stomp.MessagingException;
24 
25 /**
26  * Extends {@link MessageRequestReplyOperations} and adds operations for sending and
27  * receiving messages to and from a destination specified as a (resolvable) string name.
28  *
29  * @author Mark Fisher
30  * @author Rossen Stoyanchev
31  * @since 4.0
32  * @param (T) the destination type
33  * @see DestinationResolver
34  */
35 interface DestinationResolvingMessageRequestReplyOperations(T) : MessageRequestReplyOperations!(T) {
36 
37 	/**
38 	 * Resolve the given destination name to a destination and send the given message,
39 	 * receive a reply and return it.
40 	 * @param destinationName the name of the target destination
41 	 * @param requestMessage the mesage to send
42 	 * @return the received message, possibly {@code null} if the message could not
43 	 * be received, for example due to a timeout
44 	 */
45 	
46 	Message!(T) sendAndReceive(string destinationName, Message!(T) requestMessage);
47 
48 	/**
49 	 * Resolve the given destination name, convert the payload request Object
50 	 * to serialized form, possibly using a
51 	 * {@link hunt.stomp.converter.MessageConverter},
52 	 * wrap it as a message and send it to the resolved destination, receive a reply
53 	 * and convert its body to the specified target class.
54 	 * @param destinationName the name of the target destination
55 	 * @param request the payload for the request message to send
56 	 * @param targetClass the target class to convert the payload of the reply to
57 	 * @return the converted payload of the reply message, possibly {@code null} if
58 	 * the message could not be received, for example due to a timeout
59 	 */
60 	
61 	// <T> T convertSendAndReceive(string destinationName, Object request, Class!(T) targetClass);
62 
63 	// /**
64 	//  * Resolve the given destination name, convert the payload request Object
65 	//  * to serialized form, possibly using a
66 	//  * {@link hunt.stomp.converter.MessageConverter},
67 	//  * wrap it as a message with the given headers and send it to the resolved destination,
68 	//  * receive a reply and convert its body to the specified target class.
69 	//  * @param destinationName the name of the target destination
70 	//  * @param request the payload for the request message to send
71 	//  * @param headers the headers for the request message to send
72 	//  * @param targetClass the target class to convert the payload of the reply to
73 	//  * @return the converted payload of the reply message, possibly {@code null} if
74 	//  * the message could not be received, for example due to a timeout
75 	//  */
76 	
77 	// <T> T convertSendAndReceive(string destinationName, Object request,
78 	// 		Map!(string, Object) headers, Class!(T) targetClass);
79 
80 	// /**
81 	//  * Resolve the given destination name, convert the payload request Object
82 	//  * to serialized form, possibly using a
83 	//  * {@link hunt.stomp.converter.MessageConverter},
84 	//  * wrap it as a message, apply the given post process, and send the resulting
85 	//  * message to the resolved destination, then receive a reply and convert its
86 	//  * body to the specified target class.
87 	//  * @param destinationName the name of the target destination
88 	//  * @param request the payload for the request message to send
89 	//  * @param targetClass the target class to convert the payload of the reply to
90 	//  * @param requestPostProcessor post process for the request message
91 	//  * @return the converted payload of the reply message, possibly {@code null} if
92 	//  * the message could not be received, for example due to a timeout
93 	//  */
94 	
95 	// <T> T convertSendAndReceive(string destinationName, Object request, Class!(T) targetClass,
96 	// 		MessagePostProcessor requestPostProcessor);
97 
98 	// /**
99 	//  * Resolve the given destination name, convert the payload request Object
100 	//  * to serialized form, possibly using a
101 	//  * {@link hunt.stomp.converter.MessageConverter},
102 	//  * wrap it as a message with the given headers, apply the given post process,
103 	//  * and send the resulting message to the resolved destination, then receive
104 	//  * a reply and convert its body to the specified target class.
105 	//  * @param destinationName the name of the target destination
106 	//  * @param request the payload for the request message to send
107 	//  * @param headers the headers for the request message to send
108 	//  * @param targetClass the target class to convert the payload of the reply to
109 	//  * @param requestPostProcessor post process for the request message
110 	//  * @return the converted payload of the reply message, possibly {@code null} if
111 	//  * the message could not be received, for example due to a timeout
112 	//  */
113 	
114 	// <T> T convertSendAndReceive(string destinationName, Object request, Map!(string, Object) headers,
115 	// 		Class!(T) targetClass, MessagePostProcessor requestPostProcessor);
116 
117 }