Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Melodic
melodic-integration
Commits
bca57766
Commit
bca57766
authored
Feb 12, 2020
by
Marta Różańska
Browse files
usage of designated Solver variable in mule
parent
07dcfc93
Changes
4
Hide whitespace changes
Inline
Side-by-side
interfaces/src/main/resources/services/process/process.raml
View file @
bca57766
...
...
@@ -56,6 +56,9 @@ types:
cdoResourcePath:
type: string
description: Path in the CDO where CP and PAM models can be found.
designatedSolver:
type: string
enum: [cpsolver, lasolver, milpsolver, none, ptsolver, geneticsolver, ncsolver]
notificationSubject:
type: string
description: Notification subject that will be used when reporting the CP notification.
...
...
mule_esb/mule-integration/src/main/app/implementation.xml
View file @
bca57766
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:scripting=
"http://www.mulesoft.org/schema/mule/scripting"
xmlns:jackson2=
"http://www.mulesoft.org/schema/mule/jackson2"
xmlns:ftp=
"http://www.mulesoft.org/schema/mule/ee/ftp"
xmlns:cxf=
"http://www.mulesoft.org/schema/mule/cxf"
xmlns:orika=
"http://www.mulesoft.org/schema/mule/orika"
xmlns:mulexml=
"http://www.mulesoft.org/schema/mule/xml"
xmlns:tracking=
"http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:dw=
"http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:db=
"http://www.mulesoft.org/schema/mule/db"
xmlns:json=
"http://www.mulesoft.org/schema/mule/json"
xmlns:metadata=
"http://www.mulesoft.org/schema/mule/metadata"
xmlns:http=
"http://www.mulesoft.org/schema/mule/http"
xmlns=
"http://www.mulesoft.org/schema/mule/core"
xmlns:doc=
"http://www.mulesoft.org/schema/mule/documentation"
<mule
xmlns:imap=
"http://www.mulesoft.org/schema/mule/imap"
xmlns:scripting=
"http://www.mulesoft.org/schema/mule/scripting"
xmlns:jackson2=
"http://www.mulesoft.org/schema/mule/jackson2"
xmlns:ftp=
"http://www.mulesoft.org/schema/mule/ee/ftp"
xmlns:cxf=
"http://www.mulesoft.org/schema/mule/cxf"
xmlns:orika=
"http://www.mulesoft.org/schema/mule/orika"
xmlns:mulexml=
"http://www.mulesoft.org/schema/mule/xml"
xmlns:tracking=
"http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:dw=
"http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:db=
"http://www.mulesoft.org/schema/mule/db"
xmlns:json=
"http://www.mulesoft.org/schema/mule/json"
xmlns:metadata=
"http://www.mulesoft.org/schema/mule/metadata"
xmlns:http=
"http://www.mulesoft.org/schema/mule/http"
xmlns=
"http://www.mulesoft.org/schema/mule/core"
xmlns:doc=
"http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
...
...
@@ -15,7 +15,8 @@ http://www.mulesoft.org/schema/mule/orika http://www.mulesoft.org/schema/mule/or
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/ee/ftp http://www.mulesoft.org/schema/mule/ee/ftp/current/mule-ftp-ee.xsd
http://www.mulesoft.org/schema/mule/jackson2 http://www.mulesoft.org/schema/mule/jackson2/current/mule-jackson2.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"
>
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/imap/current/mule-imap.xsd"
>
<cxf:configuration
name=
"CXF_Configuration"
enableMuleSoapHeaders=
"true"
initializeStaticBusInstance=
"true"
doc:name=
"CXF Configuration"
/>
<jackson2:config
name=
"ToConstraintProblemRequestImpl"
returnClass=
"eu.melodic.models.services.process.ConstraintProblemRequestImpl"
doc:name=
"Jackson2: Configuration"
/>
<jackson2:config
name=
"ToSolutionRequestImpl"
returnClass=
"eu.melodic.models.services.process.SolutionRequestImpl"
doc:name=
"Jackson2: Configuration"
/>
...
...
@@ -35,6 +36,7 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
<jackson2:config
name=
"ToDataModelRequestImpl"
returnClass=
"eu.melodic.models.services.process.DataModelRequestImpl"
doc:name=
"Jackson2: Configuration"
/>
<jackson2:config
name=
"ToEventModelRequestImpl"
returnClass=
"eu.melodic.models.services.process.EventModelRequestImpl"
doc:name=
"Jackson2: Configuration"
/>
<jackson2:config
name=
"ToMonitorsDataRequestImpl"
returnClass=
"eu.melodic.models.services.adapter.MonitorsDataRequestImpl"
doc:name=
"Jackson2: Configuration"
/>
<http:request-config
name=
"PTSolver_HTTP_Request_Configuration"
host=
"${pt_solver.http.host}"
port=
"${pt_solver.http.port}"
responseTimeout=
"40000"
doc:name=
"HTTP Request Configuration"
/>
<flow
name=
"FeedAndDeploy"
>
<logger
message=
"Token basen authorization."
level=
"INFO"
doc:name=
"Logger"
/>
<set-variable
variableName=
"melodicAuthorizationToken"
value=
"#[message.inboundProperties['authorization']]"
doc:name=
"Variable"
/>
...
...
@@ -359,6 +361,7 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
<set-property
propertyName=
"http.status"
value=
"#[message.inboundProperties.'http.status']"
doc:name=
"Copy_of_Copy_of_Set Http status"
/>
<flow-ref
name=
"LogPayload"
doc:name=
"LogPayload"
/>
</flow>
<flow
name=
"constraintProblemNotification_POST"
>
<flow-ref
name=
"saveEntryRequest"
doc:name=
"saveEntryRequest"
/>
<set-variable
variableName=
"processVariables"
value=
"{ "cpCdoPath" : {"value" : "#[flowVars.entryRequest.cdoResourcePath]", "type": "String"}, "cpCreationResultCode" : {"value" : "#[flowVars.entryRequest.result.status]", "type": "String"} }"
doc:name=
"set process variables"
/>
...
...
@@ -537,14 +540,28 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
<jackson2:write-value-as-string
config-ref=
"ToConstraintProblemRequestImpl"
doc:name=
"To JSON"
/>
<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"
/>
<set-variable
variableName=
"designatedSolver"
value=
"#[json:designatedSolver]"
doc:name=
"DesignatedSolver Variable"
/>
<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}"
doc:name=
"Until Successful"
synchronous=
"true"
>
<processor-chain
doc:name=
"Processor Chain"
>
<http:request
config-ref=
"CPSolver_HTTP_Request_Configuration"
path=
"/constraintProblemSolution"
method=
"POST"
doc:name=
"CPSolver"
>
<http:failure-status-code-validator
values=
"0"
/>
</http:request>
</processor-chain>
</until-successful>
<choice
doc:name=
"Copy_of_Choice"
>
<when
expression=
"flowVars.designatedSolver == ptsolver"
>
<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=
"PTSolver_HTTP_Request_Configuration"
path=
"/constraintProblemSolution"
method=
"POST"
doc:name=
"PtSolver"
>
<http:failure-status-code-validator
values=
"0"
/>
</http:request>
</processor-chain>
</until-successful>
</when>
<otherwise>
<until-successful
maxRetries=
"${eai.http.failover.nb_of_retries}"
millisBetweenRetries=
"${eai.http.failover.timeout}"
synchronous=
"true"
doc:name=
"Until Successful"
>
<processor-chain
doc:name=
"Processor Chain"
>
<http:request
config-ref=
"CPSolver_HTTP_Request_Configuration"
path=
"/constraintProblemSolution"
method=
"POST"
doc:name=
"CPSolver"
>
<http:failure-status-code-validator
values=
"0"
/>
</http:request>
</processor-chain>
</until-successful>
</otherwise>
</choice>
<set-property
propertyName=
"http.status"
value=
"#[message.inboundProperties.'http.status']"
doc:name=
"Copy_of_Set Http status"
/>
<flow-ref
name=
"LogPayload"
doc:name=
"LogPayload"
/>
</flow>
...
...
mule_esb/mule-integration/src/main/resources/eu.melodic.integration.mule.properties
View file @
bca57766
...
...
@@ -30,6 +30,10 @@ cp_solver.http.host=mc3
cp_solver.http.port
=
8093
cp_solver.useUtilityGenerator
=
false
pt_solver.http.host
=
mc3
pt_solver.http.port
=
8090
pt_solver.useUtilityGenerator
=
false
#http retry configuration when requesting external systems
eai.http.failover.nb_of_retries
=
10
eai.http.failover.timeout
=
5000
...
...
process/src/main/java/eu/melodic/bpm/services/ApplicationDeploymentExecutor.java
View file @
bca57766
...
...
@@ -209,8 +209,12 @@ public class ApplicationDeploymentExecutor {
if
(
execution
.
getVariable
(
"designatedSolver"
)
!=
null
){
desingatedSolver
=(
String
)
execution
.
getVariable
(
"designatedSolver"
);
}
log
.
warn
(
"Designated Solver: "
+
desingatedSolver
+
", nevertheless using CP Solver."
);
//currently only cp-solver implemented and tested. To change when new solvers appear.
SolutionRequest
request
=
prepareSolutionRequest
(
execution
.
getVariable
(
APPLICATION_ID_VARIABLE
).
toString
(),
execution
.
getVariable
(
"cpCdoPath"
).
toString
(),
execution
.
getVariable
(
"businessKey"
).
toString
());
else
{
log
.
warn
(
"Designated Solver was not defined, using CP Solver."
);
desingatedSolver
=
SolutionRequest
.
DesignatedSolverType
.
CPSOLVER
.
name
();
}
log
.
info
(
"Designated Solver: "
+
desingatedSolver
);
SolutionRequest
request
=
prepareSolutionRequest
(
execution
.
getVariable
(
APPLICATION_ID_VARIABLE
).
toString
(),
execution
.
getVariable
(
"cpCdoPath"
).
toString
(),
execution
.
getVariable
(
"businessKey"
).
toString
(),
desingatedSolver
);
log
.
info
(
"ConstraintProblemSolutionRequest prepared. Sending..."
);
sendAuthorizedPOSTRequest
(
execution
,
request
,
"solution"
,
execution
.
getVariable
(
ACCESS_TOKEN_VARIABLE
).
toString
());
log
.
info
(
"ConstraintProblemSolutionRequest sent."
);
...
...
@@ -416,12 +420,13 @@ public class ApplicationDeploymentExecutor {
return
request
;
}
private
SolutionRequest
prepareSolutionRequest
(
String
applicationId
,
String
cdoResourcePath
,
String
uuid
)
{
private
SolutionRequest
prepareSolutionRequest
(
String
applicationId
,
String
cdoResourcePath
,
String
uuid
,
String
designatedSolver
)
{
SolutionRequest
request
=
new
SolutionRequestImpl
();
request
.
setCdoResourcePath
(
cdoResourcePath
);
request
.
setApplicationId
(
applicationId
);
request
.
setNotificationSubject
(
"ConstraintProblemSolutionNotification"
);
request
.
setProcessId
(
uuid
);
request
.
setDesignatedSolver
(
SolutionRequest
.
DesignatedSolverType
.
valueOf
(
designatedSolver
));
request
.
setWatermark
(
prepareWatermark
(
uuid
));
return
request
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment