| 1 |
package org.astrogrid.samp.client; |
| 2 |
|
| 3 |
import org.astrogrid.samp.Response; |
| 4 |
|
| 5 |
/** |
| 6 |
* Interface for a client which wishes to receive responses to message it |
| 7 |
* has sent asynchrnonously using <code>call</code> or <code>callAll</code>. |
| 8 |
* |
| 9 |
* @author Mark Taylor |
| 10 |
* @since 16 Jul 2008 |
| 11 |
*/ |
| 12 |
public interface ResponseHandler { |
| 13 |
|
| 14 |
/** |
| 15 |
* Indicates whether this handler will process the response with a |
| 16 |
* given <em>message tag</em>. |
| 17 |
* |
| 18 |
* @param msgTag tag with which earlier call was labelled |
| 19 |
* @return true iff this handler wants to process the response labelled |
| 20 |
* with <code>msgTag</code> |
| 21 |
*/ |
| 22 |
boolean ownsTag( String msgTag ); |
| 23 |
|
| 24 |
/** |
| 25 |
* Processes a response to an earlier message. |
| 26 |
* Will only be called for <code>msgTag</code> values which return |
| 27 |
* <code>true</code> from {@link #ownsTag}. |
| 28 |
* |
| 29 |
* @param connection hub connection |
| 30 |
* @param responderId client id of client sending response |
| 31 |
* @param msgTag message tag from previous call |
| 32 |
* @param response response object |
| 33 |
*/ |
| 34 |
void receiveResponse( HubConnection connection, String responderId, |
| 35 |
String msgTag, Response response ) |
| 36 |
throws Exception; |
| 37 |
} |