WSO2 ESB将HTTP 404视为网络错误

WSO2 ESB将HTTP 404视为网络错误,wso2,wso2esb,Wso2,Wso2esb,我有两个端点。我希望它们能够负载平衡流量,并充当故障切换机制。说故障转移,我的意思是,当一个端点没有响应(目标服务因任何原因关闭)时,第二个端点会占用所有通信量。我使用以下配置: <send> <endpoint> <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin"> <endpoint name="bsz2

我有两个端点。我希望它们能够负载平衡流量,并充当故障切换机制。说故障转移,我的意思是,当一个端点没有响应(目标服务因任何原因关闭)时,第二个端点会占用所有通信量。我使用以下配置:

<send>
    <endpoint>
        <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
            <endpoint name="bsz2_mock_ep1">
                <address uri="http://10.16.105.197:8080/bsz2_mock"/>
            </endpoint>
            <endpoint name="bsz2_mock_ep2">
                <address uri="http://10.16.105.198:8080/bsz2_mock"/>
            </endpoint>
        </loadbalance>
    </endpoint>
</send>
我将WSO2 ESB 4.8.1与NHttp传输一起使用(不是默认的传递)


如何配置ESB以满足我的需求?

可以使用[1]中给出的配置来实现需求

在[2]中找到给定场景的ESB控制台

[1]

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="bsz2_mock_ep2">
   <http uri-template="http://10.16.105.198:8080/bsz2_mock" method="post">
      <suspendOnFailure>
         <errorCodes>101506,101510,101503,101504</errorCodes>
         <initialDuration>1000</initialDuration>
         <progressionFactor>1.2</progressionFactor>
         <maximumDuration>5000</maximumDuration>
      </suspendOnFailure>
      <markForSuspension>
         <retriesBeforeSuspension>0</retriesBeforeSuspension>
         <retryDelay>1000</retryDelay>
      </markForSuspension>
   </http>
</endpoint>

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="bsz2_mock_ep2">
   <http uri-template="http://10.16.105.198:8080/bsz2_mock" method="post">
      <suspendOnFailure>
         <initialDuration>1000</initialDuration>
         <progressionFactor>1.2</progressionFactor>
         <maximumDuration>5000</maximumDuration>
      </suspendOnFailure>
      <markForSuspension>
         <errorCodes>101506,101510,101503,101504</errorCodes>
         <retriesBeforeSuspension>0</retriesBeforeSuspension>
         <retryDelay>1000</retryDelay>
      </markForSuspension>
   </http>
</endpoint>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <proxy name="loadbalance"
          transports="https http"
          startOnLoad="true"
          trace="disable">
      <description/>
      <target>
         <inSequence onError="myfault">
            <send>
               <endpoint>
                  <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
                     <endpoint name="e1">
                        <address uri="http://localhost:9001/services/SimpleStockQuoteService"/>
                     </endpoint>
                     <endpoint name="e2">
                        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                     </endpoint>
                     <endpoint name="e3">
                        <address uri="http://localhost:9003/services/SimpleStockQuoteService"/>
                     </endpoint>
                  </loadbalance>
               </endpoint>
            </send>
         </inSequence>
      </target>
   </proxy>
   <sequence name="myfault">
      <log level="custom">
         <property name="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"  value="Log sequence hit"/>
      </log>
      <drop/>
   </sequence>
</definitions>
[2015-02-01 14:36:20,988]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2015-02-01 14:36:20,987+0530]
[2015-02-01 14:37:23,553]  INFO - TimeoutHandler This engine will expire all callbacks after : 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2015-02-01 14:37:23,563]  WARN - ConnectCallback Connection refused or failed for : localhost/127.0.0.1:9001
[2015-02-01 14:37:23,567]  WARN - EndpointContext Endpoint : e1 will be marked SUSPENDED as it failed
[2015-02-01 14:37:23,568]  WARN - EndpointContext Suspending endpoint : e1 - current suspend duration is : 30000ms - Next retry after : Sun Feb 01 14:37:53 IST 2015
[2015-02-01 14:37:23,568]  WARN - LoadbalanceEndpoint AnonymousEndpoint Detect a Failure in a child endpoint : Endpoint [e1]
[2015-02-01 14:37:23,570]  WARN - ConnectCallback Connection refused or failed for : localhost/127.0.0.1:9000
[2015-02-01 14:37:23,570]  WARN - EndpointContext Endpoint : e2 will be marked SUSPENDED as it failed
[2015-02-01 14:37:23,571]  WARN - EndpointContext Suspending endpoint : e2 - current suspend duration is : 30000ms - Next retry after : Sun Feb 01 14:37:53 IST 2015
[2015-02-01 14:37:23,571]  WARN - LoadbalanceEndpoint AnonymousEndpoint Detect a Failure in a child endpoint : Endpoint [e2]
[2015-02-01 14:37:23,573]  WARN - ConnectCallback Connection refused or failed for : localhost/127.0.0.1:9003
[2015-02-01 14:37:23,573]  WARN - EndpointContext Endpoint : e3 will be marked SUSPENDED as it failed
[2015-02-01 14:37:23,574]  WARN - EndpointContext Suspending endpoint : e3 - current suspend duration is : 30000ms - Next retry after : Sun Feb 01 14:37:53 IST 2015
[2015-02-01 14:37:23,574]  WARN - LoadbalanceEndpoint AnonymousEndpoint Detect a Failure in a child endpoint : Endpoint [e3]
[2015-02-01 14:37:23,574]  WARN - LoadbalanceEndpoint Loadbalance endpoint : AnonymousEndpoint - no ready child endpoints
[2015-02-01 14:37:23,575]  INFO - LogMediator XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = Log sequence hit