Я пытаюсь настроить простой http-входящий шлюз, который примет запрос GET и отправит некоторый ответ в качестве полезной нагрузки в JSON. Конфигурация интеграции Spring ниже
<int:channel id="employeeSearchRequest" />
<int:channel id="employeeSearchResponse" />
<int-http:inbound-gateway id="inboundEmployeeSearchRequestGateway"
supported-methods="GET, POST"
request-channel="employeeSearchRequest"
reply-channel="employeeSearchResponse"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
view-name="/employee"
path="/services/employee/{id}/search"
reply-timeout="50000">
<int-http:header name="employeeId" expression="#pathVariables.id"/>
</int-http:inbound-gateway>
<int:service-activator id="employeeServiceActivator"
input-channel="employeeSearchRequest"
output-channel="employeeSearchResponse"
ref="employeeSearchService"
method="getEmployee"
requires-reply="true"
send-timeout="60000"/>
Служба поиска сотрудников выглядит следующим образом:
@Service("employeeSearchService")
public class EmployeeSearchService {
private static Log logger = LogFactory.getLog(EmployeeSearchService.class);
/**
* The API <code>getEmployee()</code> looks up the mapped in coming message header's id param
* and fills the return object with the appropriate employee details. The return
* object is wrapped in Spring Integration Message with response headers filled in.
* This example shows the usage of URL path variables and how the service act on
* those variables.
* @param inMessage
* @return an instance of <code>{@link Message}</code> that wraps <code>{@link EmployeeList}</code>
*/
public Message<PersonInfo> getEmployee(Message<?> inMessage){
Map<String, Object> responseHeaderMap = new HashMap<String, Object>();
MessageHeaders headers = inMessage.getHeaders();
String id = (String)headers.get("employeeId");
System.out.println("Oreeeeee " + id);
PersonInfo info=new PersonInfo();
info.setId(id);
setReturnStatusAndMessage(responseHeaderMap);
Message<PersonInfo> message = new GenericMessage<PersonInfo>(info, responseHeaderMap);
return message;
}
/**
* The API <code>setReturnStatusAndMessage()</code> sets the return status and return message
* in the return message payload and its header.
* @param status
* @param message
* @param employeeList
* @param responseHeaderMap
*/
private void setReturnStatusAndMessage(
Map<String, Object> responseHeaderMap){
responseHeaderMap.put("Return-Status", "Good");
responseHeaderMap.put("Return-Status-Msg", "Maal peyechi");
}
}
Когда я нажимаю на конечную точку от почтальона, заголовки заполняются, но полезная нагрузка не приходит как и ожидалось, он выглядит так:
{
"timestamp": 1581752821403,
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/services/employee/12/search"
}
У меня есть com.faster xml .jackson.core в classpath.
Любые указатели, что мне не хватает