org.apache.tuscany.sca.invocation.Message.setFrom()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.apache.tuscany.sca.invocation.Message.setFrom()方法的一些代码示例,展示了Message.setFrom()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setFrom()方法的具体详情如下:
包路径:org.apache.tuscany.sca.invocation.Message
类名称:Message
方法名:setFrom

Message.setFrom介绍

[英]Set the end point reference of the reference originating the message
[中]设置发起消息的引用的端点引用

代码示例

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeRequest(Message msg) { 
    EndpointReference from = assemblyFactory.createEndpointReference();
    Endpoint fromEndpoint = assemblyFactory.createEndpoint();
    from.setTargetEndpoint(fromEndpoint);
    from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
    msg.setFrom(from);
    return msg;
} // end method invokeRequest

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public void invokeAsyncResponse(Message msg) {
  msg = processResponse(msg);
  // Handle async response Relates_To message ID value
  @SuppressWarnings("unchecked")
  AsyncResponseInvoker<RuntimeEndpointReference> respInvoker = 
    (AsyncResponseInvoker<RuntimeEndpointReference>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
  // TODO - this deals with the Local case only - not distributed
  if( respInvoker != null && "SCA_LOCAL".equals(respInvoker.getBindingType()) ) {
    RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress();
    msg.setFrom(responseEPR);
    String msgID = respInvoker.getRelatesToMsgID();
    msg.getHeaders().put("RELATES_TO", msgID);
  } // end if
  InvokerAsyncResponse thePrevious = (InvokerAsyncResponse)getPrevious();
  if (thePrevious != null ) thePrevious.invokeAsyncResponse(msg);
} // end method invokeAsyncResponse

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

public void invokeAsyncResponse(Message msg) {
  msg = processResponse(msg);
  // Handle async response Relates_To message ID value
  @SuppressWarnings("unchecked")
  AsyncResponseInvoker<RuntimeEndpointReference> respInvoker = 
    (AsyncResponseInvoker<RuntimeEndpointReference>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
  // TODO - this deals with the Local case only - not distributed
  if( respInvoker != null && "SCA_LOCAL".equals(respInvoker.getBindingType()) ) {
    RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress();
    msg.setFrom(responseEPR);
    String msgID = respInvoker.getRelatesToMsgID();
    msg.getHeaders().put("RELATES_TO", msgID);
  } // end if
  InvokerAsyncResponse thePrevious = (InvokerAsyncResponse)getPrevious();
  if (thePrevious != null ) thePrevious.invokeAsyncResponse(msg);
} // end method invokeAsyncResponse

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

msg.setFrom(responseEPR);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

msg.setFrom(responseEPR);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-comet-runtime

/**
 * Creates a message with a mocked EndpointReference in the 'from' field to
 * simulate a comet reference (because requests are coming from browsers).
 * This is needed by the callback mechanism to have a source for the
 * request.
 * 
 * @param args
 *            arguments for the method invocation
 * @param sessionId
 *            the session id of the client
 * @param callbackMethod
 *            method to call once a response is available
 * @return an invocation message
 */
private Message createMessageWithMockedCometReference(Object[] args, String sessionId, String callbackMethod) {
  Message msg = new MessageImpl();
  msg.getHeaders().put(Constants.MESSAGE_ID, sessionId);
  msg.setBody(args);
  EndpointReference re = new RuntimeEndpointReferenceImpl();
  RuntimeEndpointImpl callbackEndpoint = new RuntimeEndpointImpl();
  callbackEndpoint.setURI(callbackMethod);
  re.setCallbackEndpoint(callbackEndpoint);
  msg.setFrom(re);
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public Message invoke(InvocationChain chain, Message msg) {
  if (invocable instanceof Endpoint) {
    msg.setTo((Endpoint)invocable);
  } else if (invocable instanceof EndpointReference) {
    msg.setFrom((EndpointReference)invocable);
  }
  Invoker headInvoker = chain.getHeadInvoker();
  Operation operation = chain.getTargetOperation();
  msg.setOperation(operation);
  Message msgContext = ThreadMessageContext.setMessageContext(msg);
  try {
    return headInvoker.invoke(msg);
  } finally {
    ThreadMessageContext.setMessageContext(msgContext);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

epr.rebuild();
msg.setFrom(epr);
msg.setTo(epr.getTargetEndpoint());

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

msg.setFrom(responseEndpointReference);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

Message msg = messageFactory.createMessage();
if (invocable instanceof RuntimeEndpointReference) {
  msg.setFrom((RuntimeEndpointReference)invocable);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

Message msg = messageFactory.createMessage();
if (source instanceof RuntimeEndpointReference) {
  msg.setFrom((RuntimeEndpointReference)source);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

Message msg = messageFactory.createMessage();
if (source instanceof RuntimeEndpointReference) {
  msg.setFrom((RuntimeEndpointReference)source);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2

/**
 * If there is a callback address, create an EPR for the callback with a referenced endpoint that contains
 * the binding and the target callback address
 * @param callbackAddress - the callback address - may be null
 * @param inMC - the Axis incoming message context
 * @param msg - the Tuscany message
 * @throws AxisFault - if the callback address has any of the disallowed forms of callback address
 */
private void createCallbackEPR( String callbackAddress, MessageContext inMC, Message msg ) throws AxisFault {
  if (callbackAddress != null ) {
    // Check for special (& not allowed!) WS_Addressing values
    checkCallbackAddress( callbackAddress, inMC );
    //
    EndpointReference from = assemblyFactory.createEndpointReference();
    Endpoint fromEndpoint = assemblyFactory.createEndpoint();
    from.setTargetEndpoint(fromEndpoint);
    from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
    msg.setFrom(from);
    RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
    //
    WebServiceBinding cbBinding = webServiceBindingFactory.createWebServiceBinding();
    cbBinding.setURI(callbackAddress);
    callbackEndpoint.setBinding(cbBinding);
    //
    callbackEndpoint.setURI(callbackAddress);
    callbackEndpoint.setUnresolved(true);
    from.setCallbackEndpoint(callbackEndpoint);
  } // end if
} // end method createCallbackEPR

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

from.setTargetEndpoint(fromEndpoint);
from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
requestMsg.setFrom(from);
RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();

相关文章