summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-12-20 19:26:33 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-12-20 19:26:33 +0000
commit3c7130f5e2a0ef58e77997fd70b678172d2e1cce (patch)
tree229b01b3dc9fbf7f17a2673d17f325fd5f2807db /sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java
parent9611e82a2204d63a47ec973c431251341142e52f (diff)
Updating core invocation code to support bindings that provide native async support - as described in TUSCANY-3801
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1051249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java55
1 files changed, 43 insertions, 12 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java
index 9c327defbd..fd07911084 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.core.invocation;
+import java.io.Serializable;
+
import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.provider.EndpointAsyncProvider;
@@ -30,20 +32,33 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
* and hides the decision about whether the response will be processed
* natively or non-natively
*/
-public class AsyncResponseInvoker implements InvokerAsyncResponse {
-
- RuntimeEndpoint requestEndpoint;
- RuntimeEndpointReference responseEndpointReference;
+public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializable {
- public AsyncResponseInvoker(Message requestMessage){
- requestEndpoint = (RuntimeEndpoint)requestMessage.getTo();
- responseEndpointReference = (RuntimeEndpointReference)requestMessage.getFrom();
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7992598227671386588L;
+ RuntimeEndpoint requestEndpoint;
+ RuntimeEndpointReference responseEndpointReference;
+ String responseTargetAddress;
+ String relatesToMsgID;
+
+ public AsyncResponseInvoker(RuntimeEndpoint requestEndpoint,
+ RuntimeEndpointReference responseEndpointReference,
+ String responseTargetAddress, String relatesToMsgID) {
+ super();
+ this.requestEndpoint = requestEndpoint;
+ this.responseEndpointReference = responseEndpointReference;
+ this.responseTargetAddress = responseTargetAddress;
+ this.relatesToMsgID = relatesToMsgID;
+ } // end constructor
+
/**
* If you have a Tuscany message you can call this
*/
public void invokeAsyncResponse(Message responseMessage) {
+ responseMessage.getHeaders().put("ASYNC_RESPONSE_INVOKER", this);
if ((requestEndpoint.getBindingProvider() instanceof EndpointAsyncProvider) &&
(((EndpointAsyncProvider)requestEndpoint.getBindingProvider()).supportsNativeAsync())){
// process the response as a native async response
@@ -52,9 +67,25 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse {
// process the response as a non-native async response
responseEndpointReference.invoke(responseMessage);
}
- }
+ } // end method invokeAsyncReponse(Message)
- /**
+ public String getResponseTargetAddress() {
+ return responseTargetAddress;
+ }
+
+ public void setResponseTargetAddress(String responseTargetAddress) {
+ this.responseTargetAddress = responseTargetAddress;
+ }
+
+ public String getRelatesToMsgID() {
+ return relatesToMsgID;
+ }
+
+ public void setRelatesToMsgID(String relatesToMsgID) {
+ this.relatesToMsgID = relatesToMsgID;
+ }
+
+ /**
* If you have Java beans you can call this and we'll create
* a Tuscany message
*
@@ -66,5 +97,5 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse {
// turn args into a message
Message responseMessage = null;
invokeAsyncResponse(responseMessage);
- }
-}
+ } // end method invokeAsyncResponse(Object)
+} // end class