0
Spring (boot) integration
을 구현했습니다. InboundChannelAdapter
이 있고이 메서드는 RestTemplate을 통해 웹 요청을 보내고 결과를 Splitter, Filter에 전달하고 마지막으로 ServiceActivator, ServiceActivator에 데이터를 데이터베이스에 저장합니다. . 데이터를 데이터베이스에 저장 한 후 메시지의 일부 추가 프로세스를 위해 새 "InboundChannelAdapter
"에 메시지를 전달하고 싶습니다. 어떻게 구현해야합니까?
내 솔루션이 올바른 솔루션입니까?ServiceActivator에서 새로운 InboundChannelAdapter로 메시지 전달
@InboundChannelAdapter(value = "channel1", poller = @Poller("downloadTrigger"))
public ResponseEntity<AppsItemParser[]> download()
{
String url = config.getUrl();
// Call a rest webservice
return responseEntity;
}
@Splitter(inputChannel = "channel1", outputChannel = "channel2")
public List<AppsItemParser> scrape(ResponseEntity<AppsItemParser[]> payload)
{
return new ArrayList<AppsItemParser>(Arrays.asList(payload.getBody()));
}
@Transformer(inputChannel = "channel2", outputChannel = "channel3")
public App convert(AppsItemParser payload)
{
App app = new App();
app.setAddDate(payload.getAddDate());
app.setSize(payload.getSize());
return app;
}
@Filter(inputChannel = "channel3", outputChannel = "channel4")
public boolean filter(App app)
{
final Set<ConstraintViolation<App>> violations = validator.validate(app);
if (violations != null && !violations.isEmpty())
{
return false;
}
return true;
}
@ServiceActivator(inputChannel = "channel4")
public void save(App app)
{
appRepository.save(app);
//Send message to another spring integration flow
}
이 주제에 관한 당신에게 채팅이 가능한가요 ... 서비스가 결과를 반환해야? – Ali
새 POJO를 ServiceActivator 위의 새 채널로 보내고 싶습니다. 새 채널에서 다른 외부 HTTP 서버에 연결하고 페이로드를 트랜스포머로 전달하고 필터링 한 다음 저장하고 싶습니다. – Ali
내가 당신에게 보여준 바로 그 일을 할 것이고, 앱은 '다음'채널로 전송 될 것입니다. 그 후에 원하는 구성 요소를 추가 할 수 있습니다. –