As it is described, that is exactly what I was looking for.  I appreciate
the quick response and the complete explanation and sample.  From a system
administration standpoint, this could be one of the best loved features.
Being able to catch timeouts and do something about it is so much more
powerful than grepping log files for timeouts after users start
complaining.  I look forward to version 1.0.
~john



On 4/16/07, Chathura Ekanayake <[EMAIL PROTECTED]> wrote:

Hi Bouck,

I have implemented timeout functionality for Synapse. Now it is possible
to impose timeout rules for endpoints in the configuration itself.

Example address endpoint configuration containing the new timeout tags is
shown below:

<endpoint>
     <address uri="http://localhost:9001/axis2/services/Service1";>
         <enableAddressing/>
         <timeout>
             <duration>5000</duration>
             <action>fault</action>
         </timeout>
     </address>
</endpoint>

Above endpoint will wait for 5 seconds for a response from the server and
activates the fault sequence if a response does not arrive within that
time.

The <action> element in the <timeout> can contain either "discard" or
"fault".
If "discard" is specified, responses arriving after the timeout will be
simple discarded
and won't be sent to the client. "fault" will activate the fault sequence
applicable for
the endpoint.

I am listing the complete Synapse configuration to your example scenario
below.

<definitions xmlns="http://ws.apache.org/ns/synapse";>

   <proxy name="Service1">
       <target>
           <endpoint>
               <address uri="http://localhost:9001/axis2/services/Service1
">
                   <enableAddressing/>
                   <timeout>
                       <duration>5000</duration>
                       <action>fault</action>
                   </timeout>
               </address>
           </endpoint>

           <faultSequence>
               <filter source="get-property('error-code')" regex="504">
                   <makefault>
                       <code value="tns:Receiver" xmlns:tns="
http://www.w3.org/2003/05/soap-envelope"/>
                       <reason value="RESPONSE TIME OUT"/>
                   </makefault>

                   <header name="To" action="remove"/>
                   <property name="RESPONSE" value="true"/>

                   <send/>
               </filter>

           </faultSequence>
       </target>
   </proxy>
</definitions>

Above configuration creates a proxy service names "Service1" to which an
address endpoint is associated.
Timeout of the address endpoint is set to 5 seconds. If a timeout occurs
the
fault sequence of the
proxy service will be activated. The error code is compared inside the
fault
sequence to identify the exact
cause of error. If the error is a timeout (504), a fault is sent to the
client with the reason "RESPONSE TIME OUT".

As you can put any mediator sequence inside the fault sequence, you can
perform any action inside it. For
example you can log a fault and send a fault message to some special fault
handling service.

Hope this helps. Your feedback is always welcome specially as you have
come
across this as a user.

Regards,
Chathura

On 4/3/07, J Bouck <[EMAIL PROTECTED]> wrote:
>
> I am new to synapse and am working my way through the samples (0.91).  I
> have a nagging question about how quality-of-service policies should be
> configured in synapse when using proxies.
> For example, I want synapse to do something like proxy SOAP over
HTTP.  I
> want a rule that the remote endpoint has 5 seconds to return a response
or
> synapse with throw the SOAP fault itself to let the client know that
there
> are issues.  Do I configure synapse as a proxy and use some sort of
> WS-ReliableMessaging policy?  Do I write a custom mediator to implement
> this
> timeout policy?  What would the configuration look like?
> ~jb
>

Reply via email to