[ 
https://issues.apache.org/jira/browse/SYNAPSE-990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14072220#comment-14072220
 ] 

Arockia Raphael commented on SYNAPSE-990:
-----------------------------------------

Hi Isuru,
Thanks for the suggestion. This is simple and clean. Also, I figured out the 
Send mediator is using the pre loaded EndPointDefinition object which has the 
time duration. 

One more issue I am facing with your approach is getting the method name from 
the incoming  payload. If you are aware of any xpath to fetch the tag/method 
name, please let us know. Or else, I will have to write a custom Switch 
Mediator.
 
<switch source="$body/child::*[position()=1]" >                 
   <case regex=".*/getSimpleQuoteClone.*">

The mentioned regex works fine if add the followng line in SwitchMediator class 
mediate(). Basically, regex does not work with xml strings in multiple lines.

sourceText = sourceText.replaceAll("[\r\n]+", " ");

Request Payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
          <getSimpleQuoteClone xmlns="http://services.samples";>
           <symbol>IBM</symbol>
          </getSimpleQuoteClone>
 </soapenv:Body>
</soapenv:Envelope>

Any help would be appreciated!!

Thanks,
Arockia

> Endpoint Address Timeout per method/function level
> --------------------------------------------------
>
>                 Key: SYNAPSE-990
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-990
>             Project: Synapse
>          Issue Type: Improvement
>          Components: Endpoints
>    Affects Versions: 2.1
>            Reporter: Arockia Raphael
>            Assignee: Hiranya Jayathilaka
>            Priority: Minor
>
> Currently, Timeout duration is specified at end point level. The mentioned 
> timeout is applicable for any method call belongs to that service. We are 
> having a situation where some of the service methods respond within 3 seconds 
> and some other with more data will take 30 seconds. However, we do not like 
> the approach of our quick methods waiting for 30 seconds in case of 
> error/failure situations. There may be work around but would like to enquire 
> any easiest way to implement this functionality.
> Just mentioned the sample what we are trying to achieve. Thanks in advance!!
> <inSequence>
>     <send>
>       <endpoint>
>               <address        
> uri="http://localhost:9080/SimpleStockQuoteService/services/SimpleStockQuoteService";>
>                 
>                    <switch source="$ctx:envelope//method" >   --> Parse from 
> input request and retrieve the method name (soap envelope or rest )
>                     <case regex="method1">
>                       <timeout>
>                               <duration>10000</duration>
>                               <responseAction>fault</responseAction>
>                       </timeout>
>                      </case>
>                      <case regex="method2">
>                       <timeout>
>                               <duration>30000</duration>
>                               <responseAction>fault</responseAction>
>                       </timeout>
>                      </case>
>                       <default">
>                       <timeout>
>                               <duration>3000</duration>
>                               <responseAction>fault</responseAction>
>                       </timeout>
>                      </default>
>                </switch>
>  </inSequence>        



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to