arg1) {
+ return helloService.sayHello(arg0);
+ }
+ }).channel(outputChannel()).get();
+ }
+
+}
diff --git a/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloService.java b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloService.java
new file mode 100644
index 000000000..27078b85a
--- /dev/null
+++ b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloService.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.samples.helloworld;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * Simple POJO to be referenced from a Service Activator.
+ *
+ * @author Mark Fisher
+ */
+@Service
+public class HelloService {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloWorldApp.java b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloWorldApp.java
new file mode 100644
index 000000000..5752253ee
--- /dev/null
+++ b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/helloworld/HelloWorldApp.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.samples.helloworld;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.PollableChannel;
+import org.springframework.messaging.support.GenericMessage;
+
+/**
+ * Demonstrates a basic Message Endpoint that simply prepends a greeting
+ * ("Hello ") to an inbound String payload from a Message. This is a very
+ * low-level example, using Message Channels directly for both input and
+ * output. Notice that the output channel has a queue sub-element. It is
+ * therefore a PollableChannel and its consumers must invoke receive() as
+ * demonstrated below.
+ *
+ * View the configuration of the channels and the endpoint (a <service-activator/>
+ * element) in 'helloWorldDemo.xml' within this same package.
+ *
+ * @author Mark Fisher
+ * @author Oleg Zhurakousky
+ * @author Gary Russell
+ */
+public class HelloWorldApp {
+
+ private static Log logger = LogFactory.getLog(HelloWorldApp.class);
+
+ public static void main(String[] args) {
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(HelloConfig.class);
+ MessageChannel inputChannel = context.getBean("inputChannel", MessageChannel.class);
+ PollableChannel outputChannel = context.getBean("outputChannel", PollableChannel.class);
+ inputChannel.send(new GenericMessage("World"));
+ logger.info("==> HelloWorldDemo: " + outputChannel.receive(0).getPayload());
+ context.close();
+ }
+
+}
diff --git a/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerApp.java b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerApp.java
new file mode 100644
index 000000000..52a2e4a4a
--- /dev/null
+++ b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerApp.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2002-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.samples.systemtime;
+
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+
+public class PollerApp {
+
+ /**
+ * Simple application that polls the current system time 2 times every
+ * 20 seconds (20000 milliseconds).
+ *
+ * The resulting message contains the time in milliseconds and the message
+ * is routed to a Logging Channel Adapter which will print the time to the
+ * command prompt.
+ *
+ * @param args Not used.
+ */
+ @SuppressWarnings("resource")
+ public static void main(String[] args) throws Exception{
+ new AnnotationConfigApplicationContext(PollerConfig.class);
+ }
+
+}
diff --git a/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerConfig.java b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerConfig.java
new file mode 100644
index 000000000..822dfcbf4
--- /dev/null
+++ b/annotations/basic/helloworld/src/main/java/org/springframework/integration/samples/systemtime/PollerConfig.java
@@ -0,0 +1,72 @@
+package org.springframework.integration.samples.systemtime;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.annotation.InboundChannelAdapter;
+import org.springframework.integration.annotation.IntegrationComponentScan;
+import org.springframework.integration.annotation.Poller;
+import org.springframework.integration.config.EnableIntegration;
+import org.springframework.integration.core.MessageSource;
+import org.springframework.integration.dsl.IntegrationFlow;
+import org.springframework.integration.dsl.IntegrationFlows;
+import org.springframework.integration.dsl.channel.MessageChannels;
+import org.springframework.integration.handler.LoggingHandler;
+import org.springframework.integration.handler.LoggingHandler.Level;
+import org.springframework.integration.scheduling.PollerMetadata;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.scheduling.support.PeriodicTrigger;
+
+/**
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@Configuration
+@EnableIntegration
+@IntegrationComponentScan
+public class PollerConfig {
+
+ @Bean
+ public MessageChannel logger() {
+ return MessageChannels.direct().get();
+ }
+
+ @Bean(name = PollerMetadata.DEFAULT_POLLER)
+ public PollerMetadata defaultPoller() {
+ PollerMetadata pollerMetadata = new PollerMetadata();
+ pollerMetadata.setTrigger(new PeriodicTrigger(20000));
+ pollerMetadata.setMaxMessagesPerPoll(2);
+ return pollerMetadata;
+ }
+
+ @Bean
+ @InboundChannelAdapter(channel="logger", poller = @Poller(PollerMetadata.DEFAULT_POLLER))
+ public MessageSource inbound() {
+ MessageSource source = new MessageSource() {
+ public Message receive() {
+ return MessageBuilder.withPayload(System.currentTimeMillis()).build();
+ }
+ };
+ return source;
+ }
+
+ @Bean
+ public IntegrationFlow systemTimeFlow(MessageChannel logger) {
+ LoggingHandler loggingHandler = new LoggingHandler(Level.INFO);
+ loggingHandler.setLoggerName("org.springframework.integration.samples.systemtime");
+ return IntegrationFlows
+ .from(logger)
+ .handle(loggingHandler)
+ .get();
+ }
+
+}
diff --git a/annotations/basic/helloworld/src/main/resources/log4j2.xml b/annotations/basic/helloworld/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..cfeafeb3e
--- /dev/null
+++ b/annotations/basic/helloworld/src/main/resources/log4j2.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+