use of org.springframework.integration.annotation.ServiceActivator in project spring-boot by spring-projects.
the class SampleEndpoint method hello.
@ServiceActivator
public String hello(File input) throws Exception {
FileInputStream in = new FileInputStream(input);
String name = new String(StreamUtils.copyToByteArray(in));
in.close();
return this.helloWorldService.getHelloMessage(name);
}
use of org.springframework.integration.annotation.ServiceActivator in project sinsim by WilsonHu.
the class MqttService method mqttOutbound.
@Bean
@ServiceActivator(inputChannel = "mqttOutboundChannel")
public MessageHandler mqttOutbound() {
MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler("server", mqttClientFactory());
messageHandler.setAsync(true);
messageHandler.setDefaultTopic("/topic/client/test");
return messageHandler;
}
use of org.springframework.integration.annotation.ServiceActivator in project spring-cloud-gcp by spring-cloud.
the class SenderApplication method messageSender.
@Bean
@ServiceActivator(inputChannel = "pubSubOutputChannel")
public MessageHandler messageSender(PubSubTemplate pubsubTemplate) {
PubSubMessageHandler adapter = new PubSubMessageHandler(pubsubTemplate, "exampleTopic");
adapter.setPublishCallback(new ListenableFutureCallback<String>() {
@Override
public void onFailure(Throwable ex) {
LOGGER.info("There was an error sending the message.");
}
@Override
public void onSuccess(String result) {
LOGGER.info("Message was sent successfully.");
}
});
return adapter;
}
use of org.springframework.integration.annotation.ServiceActivator in project spring-integration-samples by spring-projects.
the class Application method splitter.
@Bean
@ServiceActivator(inputChannel = "splitChannel")
public MessageHandler splitter() {
DefaultMessageSplitter splitter = new DefaultMessageSplitter();
splitter.setOutputChannelName("headerEnricherChannel");
return splitter;
}
use of org.springframework.integration.annotation.ServiceActivator in project Activiti by Activiti.
the class DemoApplication method processFile.
@ServiceActivator(inputChannel = "fileChannel")
public void processFile(Message<File> message) throws IOException {
securityUtil.logInAs("system");
File payload = message.getPayload();
logger.info(">>> Processing file: " + payload.getName());
String content = FileUtils.readFileToString(payload, "UTF-8");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy HH:mm:ss");
logger.info("> Processing content: " + content + " at " + formatter.format(new Date()));
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey("categorizeProcess").withName("Processing Content: " + content).withVariable("content", content).build());
logger.info(">>> Created Process Instance: " + processInstance);
logger.info(">>> Deleting processed file: " + payload.getName());
payload.delete();
}
Aggregations