Commit 14454786 authored by Marta Różańska's avatar Marta Różańska
Browse files

new types of solvers in mule

parent a52b24ff
......@@ -11,7 +11,7 @@ http://www.springframework.org/schema/context http://www.springframework.org/sch
http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd
http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd">
<context:property-placeholder location="file://${MELODIC_CONFIG_DIR}/eu.melodic.integration.mule.properties" />
<http:listener-config name="services-eaiHTTPSListener" host="${eai.http.host}" port="${eai.http.port}" doc:name="HTTP Listener Configuration" protocol="HTTPS" tlsContext-ref="global_TLS_Context" />
<http:listener-config name="services-eaiHTTPSListener" host="${eai.http.host}" port="${eai.http.port}" doc:name="HTTP Listener Configuration" />
<http:request-config name="HTTP_Camunda_configuration" host="${camunda.host}" port="${camunda.port}" doc:name="HTTP Request Configuration" responseTimeout="40000">
<http:ntlm-authentication username="admin" password="admin"/>
<tcp:client-socket-properties connectionTimeout="30000"/>
......@@ -37,7 +37,7 @@ http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/
</http:request-config>
<http:request-config name="EMS_HTTP_Request_Configuration" host="${ems.http.host}" port="${ems.http.port}" doc:name="HTTP Request Configuration" responseTimeout="40000" protocol="HTTPS">
<tcp:client-socket-properties connectionTimeout="30000"/>
<tls:context>
<tls:context>
<tls:trust-store path="${eai.http.truststore.file}" password="${eai.http.truststore.password}" type="pkcs12"/>
</tls:context>
</http:request-config>
......@@ -60,6 +60,12 @@ http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/
<http:request-config name="PT_Solver_HTTP_Request_Configuration" host="${pt_solver.http.host}" port="${pt_solver.http.port}" doc:name="HTTP Request Configuration" responseTimeout="40000">
<tcp:client-socket-properties connectionTimeout="30000"/>
</http:request-config>
<http:request-config name="NC_Solver_HTTP_Request_Configuration" host="${nc_solver.http.host}" port="${nc_solver.http.port}" doc:name="HTTP Request Configuration" responseTimeout="40000">
<tcp:client-socket-properties connectionTimeout="30000"/>
</http:request-config>
<http:request-config name="Genetic_Solver_HTTP_Request_Configuration" host="${genetic_solver.http.host}" port="${genetic_solver.http.port}" doc:name="HTTP Request Configuration" responseTimeout="40000">
<tcp:client-socket-properties connectionTimeout="30000"/>
</http:request-config>
</mule>
......@@ -238,7 +238,8 @@ http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/ima
</flow>
<flow name="deploymentProcess_POST">
<set-variable variableName="vAppName" value="#[json:applicationId]" mimeType="application/json" doc:name="Store application ID" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e233"/>
<set-payload value="{&quot;variables&quot;: {&quot;applicationId&quot; : {&quot;value&quot; : &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;melodicAuthorizationToken&quot; : {&quot;value&quot; : &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;refreshToken&quot; : {&quot;value&quot; : &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot;}}} " mimeType="application/json" doc:name="Set Payload"/>
<set-variable variableName="isSimulation" value="#[json:isSimulation]" mimeType="application/json" doc:name="Store simulation flag"/>
<set-payload value="{&quot;variables&quot;: {&quot;applicationId&quot; : {&quot;value&quot; : &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;melodicAuthorizationToken&quot; : {&quot;value&quot; : &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;refreshToken&quot; : {&quot;value&quot; : &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;isSimulation&quot; : {&quot;value&quot; : &quot;#[flowVars.isSimulation]&quot;, &quot;type&quot;: &quot;String&quot;}}} " mimeType="application/json" doc:name="Set Payload"/>
<set-property propertyName="Content-Type" value="application/json" doc:name="set Content-Type to application/json"/>
<logger message="Payload before call camunda #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Camunda_configuration" path="/rest/engine/default/process-definition/key/${camunda.deploymentProcess.name}/start" method="POST" sendBodyMode="ALWAYS" doc:name="call Camunda"/>
......@@ -273,9 +274,10 @@ http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/ima
</when>
<otherwise>
<set-variable variableName="vAppName" value="#[json:applicationId]" mimeType="application/json" doc:name="Store application ID" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e233"/>
<set-variable variableName="isSimulation" value="#[json:isSimulation]" doc:name="Store isSimulation flag"/>
<set-variable variableName="vUseExistingCP" value="#[json:useExistingCP]" mimeType="application/json" doc:name="Store useExistingCP" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e234"/>
<set-variable variableName="vCdoResourcePath" value="#[json:cdoResourcePath]" mimeType="application/json" doc:name="Store cdoResourcePath" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e235"/>
<set-payload value="{ &quot;variables&quot;: { &quot;applicationId&quot;: { &quot;value&quot;: &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;useExistingCP&quot;: { &quot;value&quot;: &quot;#[flowVars.vUseExistingCP]&quot;, &quot;type&quot;: &quot;Boolean&quot; }, &quot;cpCdoPath&quot;: { &quot;value&quot;: &quot;#[flowVars.vCdoResourcePath]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;melodicAuthorizationToken&quot;: { &quot;value&quot;: &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;refreshToken&quot;: { &quot;value&quot;: &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot; } } }" mimeType="application/json" doc:name="Set Payload"/>
<set-payload value="{ &quot;variables&quot;: { &quot;applicationId&quot;: { &quot;value&quot;: &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;useExistingCP&quot;: { &quot;value&quot;: &quot;#[flowVars.vUseExistingCP]&quot;, &quot;type&quot;: &quot;Boolean&quot; }, &quot;cpCdoPath&quot;: { &quot;value&quot;: &quot;#[flowVars.vCdoResourcePath]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;melodicAuthorizationToken&quot;: { &quot;value&quot;: &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;refreshToken&quot;: { &quot;value&quot;: &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot; } , &quot;isSimulation&quot;: { &quot;value&quot;: &quot;#[flowVars.isSimulation]&quot;, &quot;type&quot;: &quot;String&quot; } } }" mimeType="application/json" doc:name="Set Payload"/>
<set-property propertyName="Content-Type" value="application/json" doc:name="set Content-Type to application/json"/>
<flow-ref name="LogPayload" doc:name="LogPayload"/>
<http:request config-ref="HTTP_Camunda_configuration" path="/rest/engine/default/process-definition/key/${camunda.deploymentProcess.name}/start" method="POST" sendBodyMode="ALWAYS" doc:name="call Camunda"/>
......@@ -543,7 +545,7 @@ http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/ima
<set-property propertyName="Content-Type" value="application/json" doc:name="set Content-Type to application/json"/>
<set-property propertyName="authorization" value="#[message.inboundProperties.authorization]" doc:name="Set authorization token"/>
<choice doc:name="Choice">
<when expression="#['PTSOLVER'.equals(flowVars.designatedSolver)]">
<when expression="#['PTSOLVER'.equalsIgnoreCase((flowVars.designatedSolver)])">
<logger message="Sending request to PT Solver: #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="PTSolver - Logger"/>
<until-successful maxRetries="${eai.http.failover.nb_of_retries}" millisBetweenRetries="${eai.http.failover.timeout}" synchronous="true" doc:name="Copy_of_Until Successful">
<processor-chain doc:name="Copy_of_Processor Chain">
......@@ -555,6 +557,30 @@ http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/ima
<set-property propertyName="http.status" value="#[message.inboundProperties.'http.status']" doc:name="Set Http status"/>
<flow-ref name="LogPayload" doc:name="LogPayload"/>
</when>
<when expression="#['GENETICSOLVER'.equalsIgnoreCase((flowVars.designatedSolver)])">
<logger message="Sending request to Genetic Solver: #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Genetic - Logger"/>
<until-successful maxRetries="${eai.http.failover.nb_of_retries}" millisBetweenRetries="${eai.http.failover.timeout}" synchronous="true" doc:name="Copy_of_Until Successful">
<processor-chain doc:name="Copy_of_Processor Chain">
<http:request config-ref="Genetic_Solver_HTTP_Request_Configuration" path="/constraintProblemSolution" method="POST" doc:name="GeneticSolver">
<http:failure-status-code-validator values="0"/>
</http:request>
</processor-chain>
</until-successful>
<set-property propertyName="http.status" value="#[message.inboundProperties.'http.status']" doc:name="Set Http status"/>
<flow-ref name="LogPayload" doc:name="LogPayload"/>
</when>
<when expression="#['NCSOLVER'.equalsIgnoreCase((flowVars.designatedSolver)])">
<logger message="Sending request to NC Solver: #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="NCSolver - Logger"/>
<until-successful maxRetries="${eai.http.failover.nb_of_retries}" millisBetweenRetries="${eai.http.failover.timeout}" synchronous="true" doc:name="Copy_of_Until Successful">
<processor-chain doc:name="Copy_of_Processor Chain">
<http:request config-ref="NC_Solver_HTTP_Request_Configuration" path="/constraintProblemSolution" method="POST" doc:name="NCSolver">
<http:failure-status-code-validator values="0"/>
</http:request>
</processor-chain>
</until-successful>
<set-property propertyName="http.status" value="#[message.inboundProperties.'http.status']" doc:name="Set Http status"/>
<flow-ref name="LogPayload" doc:name="LogPayload"/>
</when>
<otherwise>
<logger message="Sending request to CP Solver: #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<until-successful maxRetries="${eai.http.failover.nb_of_retries}" millisBetweenRetries="${eai.http.failover.timeout}" synchronous="true" doc:name="Until Successful">
......
......@@ -34,6 +34,14 @@ pt_solver.http.host=mc3
pt_solver.http.port=8090
pt_solver.useUtilityGenerator=false
nc_solver.http.host=mc3
nc_solver.http.port=8090
nc_solver.useUtilityGenerator=false
genetic_solver.http.host=mc3
genetic_solver.http.port=8090
genetic_solver.useUtilityGenerator=false
#http retry configuration when requesting external systems
eai.http.failover.nb_of_retries=10
eai.http.failover.timeout=5000
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment