Skip to content

Commit ac62649

Browse files
author
Johannes Duesing
committed
Adapted instance registry client to reflect the interface change in endpoints related to matching.
1 parent 7b5e1f2 commit ac62649

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/scala/de/upb/cs/swt/delphi/instancemanagement/InstanceRegistry.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ object InstanceRegistry extends JsonSupport with AppLogging
147147
if(!configuration.usingInstanceRegistry) {
148148
Failure(new RuntimeException("Cannot get ElasticSearch instance from Instance Registry, no Instance Registry available."))
149149
} else {
150-
val request = HttpRequest(method = HttpMethods.GET, configuration.instanceRegistryUri + "/matchingInstance?ComponentType=ElasticSearch")
150+
val request = HttpRequest(method = HttpMethods.GET,
151+
configuration.instanceRegistryUri +
152+
s"/matchingInstance?Id=${configuration.assignedID.getOrElse(-1)}&ComponentType=ElasticSearch")
151153

152154
Await.result(Http(system).singleRequest(request) map {response =>
153155
response.status match {
@@ -189,18 +191,17 @@ object InstanceRegistry extends JsonSupport with AppLogging
189191
val idToPost = configuration.elasticsearchInstance.id.getOrElse(-1L)
190192
val request = HttpRequest(
191193
method = HttpMethods.POST,
192-
configuration.instanceRegistryUri + s"/matchingResult?Id=$idToPost&MatchingSuccessful=$isElasticSearchReachable")
194+
configuration.instanceRegistryUri +
195+
s"/matchingResult?CallerId=${configuration.assignedID.getOrElse(-1)}&MatchedInstanceId=$idToPost&MatchingSuccessful=$isElasticSearchReachable")
193196

194197
Await.result(Http(system).singleRequest(request) map {response =>
195-
val status=response.status
196198
if(response.status == StatusCodes.OK){
197199
log.info(s"Successfully posted matching result to Instance Registry.")
198200
Success()
199201
}
200202
else {
201-
val statuscode = response.status
202-
log.warning(s"Failed to post matching result to Instance Registry, server returned $statuscode")
203-
Failure(new RuntimeException(s"Failed to post matching result to Instance Registry, server returned $statuscode"))
203+
log.warning(s"Failed to post matching result to Instance Registry, server returned ${response.status}")
204+
Failure(new RuntimeException(s"Failed to post matching result to Instance Registry, server returned ${response.status}"))
204205
}
205206

206207
} recover {case ex =>

0 commit comments

Comments
 (0)