b

spring integration + redis 본문

spring framework/spring-integration

spring integration + redis

dev.bistro 2013. 6. 3. 10:44


2년째 쓰고 있지만 맥북에어11 은... 코딩하다 담 오겠다. 주말에 깨작거리다 그냥 월요일 회사 출근해서 샘플 코드를 돌렸다.


spring-integration 과 mongodb / redis /standrd IO를 위해서는 dependency가 추가로 필요로 하다. 긴장하자

<spring.integration.version>2.2.0.RELEASE</spring.integration.version>

<dependency>

<groupId>org.springframework.integration</groupId>

<artifactId>spring-integration-redis</artifactId>

<version>${spring.integration.version}</version>

</dependency>


<dependency>

<groupId>org.springframework.integration</groupId>

<artifactId>spring-integration-mongodb</artifactId>

<version>${spring.integration.version}</version>

</dependency>

<dependency>

<groupId>org.springframework.integration</groupId>

<artifactId>spring-integration-stream</artifactId>

<version>${spring.integration.version}</version>

</dependency>


아 물론 xml 에서 NameSpace도 지정을 잘 해주자... 

공식 http://static.springsource.org/spring-integration/reference/htmlsingle/ 문서에는 해당 내용이 존재 하지 않아서 http://www.springframework.org/schema/integration/ 에서 직접 찾았다...


http://www.springframework.org/schema/integration/redis

http://www.springframework.org/schema/integration/redis/spring-integration-redis-2.2.xsd

http://www.springframework.org/schema/integration/stream

http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.2.xsd

http://www.springframework.org/schema/data/mongo 

http://www.springframework.org/schema/data/mongo/spring-mongo-1.1.xsd



<bean id="redisConnectionFactory"

class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">

<property name="hostName" value="192.168.172.153" />

<property name="port" value="2000" />

</bean>


<int-redis:store-inbound-channel-adapter

id="listAdapter" connection-factory="redisConnectionFactory" key="f"

channel="splittingChannel" collection-type="LIST" >

<int:poller fixed-rate="2000" max-messages-per-poll="1" />

</int-redis:store-inbound-channel-adapter>


<int:splitter input-channel="splittingChannel" output-channel="stdout"  />


<int-stream:stdout-channel-adapter id="stdout" append-newline="true"/>


Comments