我正在尝试构建与 Integration Studio 的集成,它必须通过多个服务并将响应发送到后端端点。这工作得很好,直到它尝试调用后端,然后它进入超时状态。
这里是 XML
<?xml version="1.0" encoding="UTF-8"?>
<api context="/salesforce" name="SFApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/anagrafiche">
<inSequence>
<property expression="$body//username" name="uri.var.username" scope="default" type="STRING"/>
<property expression="$body//password" name="uri.var.password" scope="default" type="STRING"/>
<property expression="$body//client_id" name="uri.var.client_id" scope="default" type="STRING"/>
<property expression="$body//client_secret" name="uri.var.client_secret" scope="default" type="STRING"/>
<property expression="$body//grant_type" name="uri.var.grant_type" scope="default" type="STRING"/>
<call>
<endpoint key="SFAuth"/>
<source type="body"/>
</call>
<property expression="json-eval($.access_token)" name="uri.var.accessToken" scope="default" type="STRING"/>
<header expression="fn:concat('Bearer ', $ctx:uri.var.accessToken)" name="Authorization" scope="transport"/>
<call>
<endpoint key="SFAnagrafiche"/>
</call>
<property expression="json-eval($.records)" name="uri.var.records" scope="default" type="STRING"/>
<call>
<endpoint key="BEAnagrafiche"/>
<source type="body"/>
<target type="body"/>
</call>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
该模式一直持续到它调用 BEAnagrafiche 的端点,该端点具有以下 http REST url 到 POST 方法中的 laravel 项目:
http://localhost/webidoo-project/public/api/anagrafiche
这里是 BEAnagrafiche 的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="BEAnagrafiche" xmlns="http://ws.apache.org/ns/synapse">
<http method="post" uri-template="http://localhost/webidoo-project/public/api/anagrafiche">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
<property name="data" value="$ctx:uri.var.records"/>
</endpoint>
和后端服务:
public function saveAnagrafiche(Request $request) {
return 'hello';
try {
DB::beginTransaction();
$data = $request->json();
foreach($data as $d) {
if(isset($d['attributes'])) unset($d['attributes']);
$user = new User($d);
$user->save();
}
DB::commit();
return response()->json([
'status' => true,
'message' => 'Anagrafiche salvate correttamente'
], 200);
} catch(\Exception $e) {
DB::rollback();
return response()->json([
'status' => false,
'message' => 'Errore durante il salvataggio delle anagrafiche',
'error' => $e->getMessage()
], 500);
}
}
下面还有来自 mi 控制台的最后一条消息:
直通-http.properties:
#
# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. 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.
#
#
##############################################
#
# WARNING: Don't edit the file manually unless you are not using the deployment.toml file.
#
##############################################
## This file contains the configuration parameters used by the Pass-through HTTP transport
rest.dispatcher.service=__MultitenantDispatcherService
rest_uri_api_regex=\\w+://.+:\\d+/t/.*|\\w+://.+\\w+/t/.*|^(/t/).*
rest_uri_proxy_regex=\\w+://.+:\\d+/services/t/.*|\\w+://.+\\w+/services/t/.*|^(/services/t/).*
http.socket.reuseaddr=true
http.user.agent.preserve = false
worker_pool_size_max = 400
valid.max.message.size.in.bytes = 81920
worker_pool_size_core = 400
http.max.connection.per.host.port = 32767
io_buffer_size = 16384
http.server.preserve = true
http.connection.disable.keepalive = false
http.socket.timeout=600000
force.json.message.reverseProxyMode = false
worker_pool_queue_length = -1
http.headers.preserve=Content-Type
突触属性:
#
# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. 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.
#
##############################################
#
# WARNING: Don't edit the file manually unless you are not using the deployment.toml file.
#
##############################################
opentracing.enable = false
inbound.threads.core = 20
synapse.debugger.port.command = 9005
synapse.debugger.port.event = 9006
internal.https.api.port = 9154
synapse.xpath.func.extensions = org.wso2.micro.integrator.mediation.security.vault.xpath.SecureVaultLookupXPathFunctionProvider,org.wso2.micro.integrator.mediation.security.vault.external.hashicorp.HashiCorpVaultLookupXPathFunctionProvider
jaeger.sender.agent.host = localhost
synapse.commons.json.preserve.namespace = false
jaeger.reporter.log.spans = false
internal.http.api.enabled = true
inbound.port.offset.enable = false
synapse.temp_data.chunk.size = 3072
mediation.flow.statistics.enable = false
mediation.flow.statistics.collect.all = false
internal.http.api.port = 9191
synapse.threads.core = 20
opentracing.zipkin.backend.url = http://localhost:9411/api/v2/spans
jaeger.reporter.flush.interval = 10000
inbound.threads.max = 100
synapse.global_timeout_interval = 120000
jaeger.sampler.manager.host = localhost
opentracing.zipkin.enable = false
synapse.script.mediator.pool.size = 15
jaeger.reporter.max.queue.size = 100
mediation.flow.statistics.tracer.collect.properties = false
synapse.threads.max = 100
jaeger.sender.agent.port = 6831
statistics.clean.enable = true
mediation.flow.statistics.tracer.collect.payloads = false
statistics.clean.interval = 1000
jaeger.sampler.manager.port = 5778
synapse.sal.endpoints.sesssion.timeout.default=600000
synapse.carbon.ext.tenant.info=org.wso2.micro.integrator.initializer.handler.MITenantInfoConfigurator
mediation.flow.statistics.event.consume.interval=1000
mediation.flow.statistics.event.clean.interval=15000