use of org.springframework.integration.annotation.ServiceActivator in project tutorials by eugenp.
the class FileCopyConfig method fileWritingMessageHandler.
@Bean
@ServiceActivator(inputChannel = "fileChannel")
public MessageHandler fileWritingMessageHandler() {
FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
handler.setFileExistsMode(FileExistsMode.REPLACE);
handler.setExpectReply(false);
return handler;
}
use of org.springframework.integration.annotation.ServiceActivator in project brewery by spring-cloud-samples.
the class EventListener method handleEvents.
@ServiceActivator(inputChannel = EventSink.INPUT)
public void handleEvents(Event event, @Headers Map<String, Object> headers) throws InterruptedException {
log.info("Received the following message with headers [{}] and body [{}]", headers, event);
Span newSpan = tracer.nextSpan().name("inside_reporting").start();
try (Tracer.SpanInScope ws = tracer.withSpanInScope(newSpan)) {
reportingRepository.createOrUpdate(event);
newSpan.annotate("savedEvent");
log.info("Saved event to the db", headers, event);
} finally {
newSpan.finish();
}
}
Aggregations