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

Isuru Udana Loku Narangoda commented on SYNAPSE-990:
----------------------------------------------------

Hi Arockia,

IMO, it is not a nice design to allow user to configure timeout config 
parameters based on something on the payload at the endpoint level.

To achieve your requirement, what you could do is, define several endpoints 
with different timeout intervals and within the mediation flow, using the 
switch mediator, route the message to the appropriate endpoint.

Following is a sample synapse configuration.

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse";>
   <proxy name="SampleProxy"
          transports="https http"
          startOnLoad="true"
          trace="disable">
      <description/>
      <target>
         <inSequence>
            <switch source="//method">
               <case regex="method1">
                  <send>
                     <endpoint key="Ep1"/>
                  </send>
               </case>
               <case regex="method2">
                  <send>
                     <endpoint key="Ep2"/>
                  </send>
               </case>
               <default>
                  <send>
                     <endpoint key="Ep3"/>
                  </send>
               </default>
            </switch>
         </inSequence>
      </target>
   </proxy>
   <endpoint name="Ep3">
      <address 
uri="http://localhost:9080/SimpleStockQuoteService/services/SimpleStockQuoteService";>
         <timeout>
            <duration>3000</duration>
            <responseAction>fault</responseAction>
         </timeout>
      </address>
   </endpoint>
   <endpoint name="Ep2">
      <address 
uri="http://localhost:9080/SimpleStockQuoteService/services/SimpleStockQuoteService";>
         <timeout>
            <duration>30000</duration>
            <responseAction>fault</responseAction>
         </timeout>
      </address>
   </endpoint>
   <endpoint name="Ep1">
      <address 
uri="http://localhost:9080/SimpleStockQuoteService/services/SimpleStockQuoteService";>
         <timeout>
            <duration>10000</duration>
            <responseAction>fault</responseAction>
         </timeout>
      </address>
   </endpoint>
</definitions>

> 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