Saturday, July 28, 2012

Route to an endpoint based on the time of the day - Using ESB

This can be achieved with the use of Switch Case Mediator. Following proxy service will route to an endpoint based on the time of the day.

<proxy xmlns="" name="Proxy1" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
         <switch xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" source="get-property('SYSTEM_DATE', 'HH')">
            <case regex="10">
               <log level="custom">
                  <property name="system-time" expression="get-property('SYSTEM_DATE', 'HH')" />
                     <address uri="http://localhost:8280/services/Version" format="get" />
         <send />
         <address uri="http://localhost:8280/services/Version" />
   <publishWSDL uri="http://localhost:8280/services/Version?wsdl" />

No comments:

Post a Comment