Skip to content

Instantly share code, notes, and snippets.

View cignextraining's full-sized avatar

cignextraining

View GitHub Profile
<!-- Adapter for reading files -->
<int-file:inbound-channel-adapter id="producer-file-adapter"
channel="inboundChannel" directory="file:d://si-inbound"
prevent-duplicates="true">
<int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>
<!-- a direct inbound channel -->
<int:channel id="inboundChannel" />
<!-- Adapter for reading files -->
<int-file:inbound-channel-adapter id="producer-file-adapter"
channel="inboundChannel" directory="file:d://si-inbound"
prevent-duplicates="true">
<int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>
<!-- a direct inbound channel -->
<int:channel id="inboundChannel" />
@cignextraining
cignextraining / 1-integration.xml
Created April 22, 2018 18:23
Transformers - XML Unmarshalling
<!-- Scans within the base package of the application for @Components to
configure as beans -->
<context:component-scan base-package="com.cd.spring" />
<!-- Adapter for reading files -->
<int-file:inbound-channel-adapter id="producer-file-adapter"
channel="inboundChannel" directory="file:d://si-inbound"
prevent-duplicates="true">
<int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>
<!-- Scans within the base package of the application for @Components to
configure as beans -->
<context:component-scan base-package="com.cd.spring" />
<!-- Adapter for reading stdin stream -->
<!-- message producer / a Spring Integration wrapped Java Standard input
stream -->
<int-stream:stdin-channel-adapter id="producer-stream-adapter"
channel="inboundChannel" />
@cignextraining
cignextraining / 0-shiporder.xsd
Last active April 22, 2018 17:45
Filters - XML Based
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
@cignextraining
cignextraining / FileSelector.java
Last active April 22, 2018 21:23
Filters - File
package com.cd.spring;
import java.io.File;
import org.springframework.integration.core.MessageSelector;
import org.springframework.messaging.Message;
public class FileSelector implements MessageSelector{
@Override
<!-- Inbound Adapters -->
<!-- Inbound File Adaptor which listens to d://inbound location for any files -->
<int-file:inbound-channel-adapter id="producer-file-adapter" channel="messageChannel" directory="file:d://si-inbound" prevent-duplicates="true">
<int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>
<!-- Inbound Standard Input Adapter which acts as a Message producer. A Spring Integration wrapped Java Standard input stream -->
<int-stream:stdin-channel-adapter id="producer"
channel="messageChannel" />
package com.cd.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@cignextraining
cignextraining / integration.xml
Last active April 22, 2018 21:43
SI configuration file - Starter
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-file= "http://www.springframework.org/schema/integration/file"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
@cignextraining
cignextraining / pom.xml
Created April 22, 2018 14:39
Spring Integration Starter - pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cd.spring</groupId>
<artifactId>si-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>