Migrate some code from prototype
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package demo;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.bus.runner.EnableMessageBus;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableMessageBus
|
||||
@ImportResource("classpath:/config/ticker.xml")
|
||||
@PropertySource("classpath:/config/ticker.properties")
|
||||
public class ModuleApplication {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new SpringApplicationBuilder().sources(ModuleApplication.class).run(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fixedDelay: 5
|
||||
|
||||
---
|
||||
xd:
|
||||
messagebus:
|
||||
redis:
|
||||
headers:
|
||||
# comma-delimited list of additional (string-valued) header names to transport
|
||||
default:
|
||||
# default bus properties, if not specified at the module level
|
||||
backOffInitialInterval: 1000
|
||||
backOffMaxInterval: 10000
|
||||
backOffMultiplier: 2.0
|
||||
concurrency: 1
|
||||
maxAttempts: 3
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
spring:
|
||||
bus:
|
||||
group: testtock
|
||||
name: ticker
|
||||
@@ -0,0 +1 @@
|
||||
options_class = org.springframework.xd.dirt.modules.metadata.TimeSourceOptionsMetadata
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<channel id="output"/>
|
||||
|
||||
<inbound-channel-adapter channel="output"
|
||||
auto-startup="false"
|
||||
expression="new java.text.SimpleDateFormat('${format}').format(new java.util.Date())">
|
||||
<poller trigger="fixedDelayTrigger" />
|
||||
</inbound-channel-adapter>
|
||||
|
||||
<beans:bean id="fixedDelayTrigger" class="org.springframework.scheduling.support.PeriodicTrigger">
|
||||
<beans:constructor-arg value="${fixedDelay}" />
|
||||
<beans:constructor-arg value="${timeUnit}" />
|
||||
<beans:property name="initialDelay" value="${initialDelay} "/>
|
||||
</beans:bean>
|
||||
|
||||
</beans:beans>
|
||||
@@ -0,0 +1,20 @@
|
||||
package demo;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = ModuleApplication.class)
|
||||
@WebAppConfiguration
|
||||
@DirtiesContext
|
||||
public class ModuleApplicationTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user