Added Service Activator

(cherry picked from commit 94c6cac)
This commit is contained in:
k0l0ssus 2016-10-12 05:43:04 +02:00 committed by slavisa-baeldung
parent a44be73deb
commit 9b0cfbafbf
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package com.baeldung.samples.endpoints;
public interface Activator<T> {
public void handleMessage(T input);
}

View File

@ -0,0 +1,20 @@
package com.baeldung.samples.endpoints;
import java.io.File;
import java.util.logging.Logger;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.Message;
public class ActivatorImpl implements Activator<Message<File>> {
@Override
public void handleMessage(Message<File> input) {
File filePayload = input.getPayload();
IntegrationMessageHeaderAccessor accessor = new IntegrationMessageHeaderAccessor(input);
Logger.getAnonymousLogger().info("The file size "+filePayload.length());
Logger.getAnonymousLogger().info("The time of the message "+accessor.getTimestamp());
}
}