@@ -147,7 +147,9 @@ object InstanceRegistry extends JsonSupport with AppLogging
147
147
if (! configuration.usingInstanceRegistry) {
148
148
Failure (new RuntimeException (" Cannot get ElasticSearch instance from Instance Registry, no Instance Registry available." ))
149
149
} 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 " )
151
153
152
154
Await .result(Http (system).singleRequest(request) map {response =>
153
155
response.status match {
@@ -189,18 +191,17 @@ object InstanceRegistry extends JsonSupport with AppLogging
189
191
val idToPost = configuration.elasticsearchInstance.id.getOrElse(- 1L )
190
192
val request = HttpRequest (
191
193
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" )
193
196
194
197
Await .result(Http (system).singleRequest(request) map {response =>
195
- val status = response.status
196
198
if (response.status == StatusCodes .OK ){
197
199
log.info(s " Successfully posted matching result to Instance Registry. " )
198
200
Success ()
199
201
}
200
202
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}" ))
204
205
}
205
206
206
207
} recover {case ex =>
@@ -252,7 +253,7 @@ object InstanceRegistry extends JsonSupport with AppLogging
252
253
253
254
private def createInstance (id : Option [Long ], controlPort : Int , name : String ) : Instance =
254
255
Instance (id, InetAddress .getLocalHost.getHostAddress,
255
- controlPort, name, ComponentType .WebApi , None , InstanceState .Running )
256
+ controlPort, name, ComponentType .WebApi , None , InstanceState .Running , List .empty[ String ] )
256
257
257
258
def reportStart (id : String , configuration : Configuration ): Try [ResponseEntity ] = {
258
259
val request = HttpRequest (method = HttpMethods .GET , configuration.instanceRegistryUri + " /reportStart" )
0 commit comments