<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~  Licensed to the Apache Software Foundation (ASF) under one
  ~  or more contributor license agreements.  See the NOTICE file
  ~  distributed with this work for additional information
  ~  regarding copyright ownership.  The ASF licenses this file
  ~  to you under the Apache License, Version 2.0 (the
  ~  "License"); you may not use this file except in compliance
  ~  with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing,
  ~  software distributed under the License is distributed on an
  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~  KIND, either express or implied.  See the License for the
  ~  specific language governing permissions and limitations
  ~  under the License.
  -->
        
<!-- Introduction to Synapse Dynamic Router eip function template -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
<import xmlns="http://ws.apache.org/ns/synapse" name="EipLibrary" package="synapse.lang.eip" />
 <proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
        <target>
            <inSequence>
               <call-template target="synapse.lang.eip.dynamic_router">
<with-param name="conditions" value="header=foo:bar.*#url=/services/StockQuoteProxy.*;seq=cnd1_seq,header=custom_header1:bar.*@header=custom_header1:foo.*;seq=cnd2_seq,header=custom_header2:foo.*;seq=cnd3_seq"/>
    </call-template>
     </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
    </proxy>
<sequence name="send_seq">
        <log level="custom">
            <property name="DEBUG" value="Condition Satisfied"/>
        </log>
        <send>
            <endpoint name="simple">
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
        </send>
    </sequence>

    <sequence name="cnd1_seq">
        <log level="custom">
            <property name="MSG_FLOW" value="Condition (I) Satisfied"/>
        </log>
        <sequence key="send_seq"/>
    </sequence>
    <sequence name="cnd2_seq">
        <log level="custom">
            <property name="MSG_FLOW" value="Condition (II) Satisfied"/>
        </log>
        <sequence key="send_seq"/>
    </sequence>
    <sequence name="cnd3_seq">
        <log level="custom">
            <property name="MSG_FLOW" value="Condition (III) Satisfied"/>
        </log>
        <sequence key="send_seq"/>
    </sequence>
</definitions>
