'Failed to get correlation key for `citrus_message_correlator_HttpClient`
I have a CitrusEndpoints server configuration
@Bean
public HttpServer myService() {
return CitrusEndpoints.
http().
server().
port(9999).
timeout(10000).autoStart(true).build();
My client configuration
@Bean
public HttpClient httpClient() {
return CitrusEndpoints.
http().
client().
requestUrl("http://localhost:9999/myService/downloadSomething").
contentType("multipart/form-data").
build();
}
My unit test:
actions.$(http()
.client(httpClient)
.send()
.get().path(id)
.queryParam("version","1")
.message().accept(ContentType.MULTIPART_FORM_DATA.getMimeType())
.header("Authorization", "Bearer " + token));
actions.$(http().server("http://localhost:9999/myService/downloadSomething/").receive().get( id).
queryParam("version", "1"));
actions.$(http().server("http://localhost:9999/myService/downloadSomething/").respond().message().
contentType(ContentType.MULTIPART_FORM_DATA.toString()));
actions.$(http().client(httpClient).receive().response(HttpStatus.OK)
.message(new DefaultMessage(FileCopyUtils.copyToByteArray(new ClassPathResource("documents/somedoc.pdf").getFile())))
.contentType(ContentType.MULTIPART_FORM_DATA.getMimeType()));
What I see
com.consol.citrus.exceptions.TestCaseFailedException: Failed to get correlation key for
citrus_message_correlator_HttpClient
P.S: If you notice any typos in the code, kindly ignore. I have attempted not to reveal any damning identification
Solution 1:[1]
You try to send a request as a client and at the same time to receive another request as a server. As Http is a synchronous protocol by nature you need to use fork=true option on the 1st client send action.
This should solve the problem
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Christoph Deppisch |