πŸ’»
Albert's Til
GitHub
  • 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
    • README
    • CS
      • Network
      • HTTP
        • NO-CACHE
      • 였λ₯˜ μ½”λ“œ
      • ORM 도ꡬ
      • Design Pattern
        • CQRS Pattern
          • Event Sourcing and CQRS pattern
        • Builder Pattern
    • DB
      • MySQL
        • Timeline
        • Pagination
        • Index
        • Database Performance Optimization Strategies
        • B+ tree
        • MySQL Connectors VS MySQL Shell(Scripting) VS MySQL Workbench
        • MySQL Storage Engine Architecture
      • Normalization & Denormalization
      • JPA
        • @Transactional
        • Why JPA?
        • About JPA
        • N+1 Issue
        • Index
        • ElementCollection&CollectionTable
        • orphanRemoval
        • CascadeType
        • Use Subselect
        • Dynamic Instance Creation
        • Paging
        • Order
        • Spefication
        • mappedBy
      • MongoDB
        • ObjectId
      • Why MySQL?
      • ACID properties of transactions
      • Between JPA and JDBC
      • Identifiers in Hibernate/JPA
    • Java
      • Jackson de/serialize
      • Collections.singletonList() vs List.of()
      • Manage dependencies in Gradle
      • Logging Level
      • Bean Validation
      • JVM Internals
        • Threads
          • Frame
        • Shared Between Threads
          • Classloader
            • Class Loader Hierarchy
            • Loading Linking Initialization
      • Java Collection Framework
      • Annotation
      • Generic
      • λ””λ―Έν„° 법칙
    • Spring
      • Caching
      • Spring Integration Overview
        • ThreadPollTaskExecutor
        • Messaging Bridge
        • Channel Adapter
        • Poller
        • Configuration and @EnableIntegration
        • Message Endpoints
        • Message Channels
      • HATEOAS
      • @Autowired vs Constructor Dependency Injection
      • Spring Security
        • JWT 토큰 μ‚¬μš©ν•œ 인가
        • OAuth 2 Login
        • OAuth 2 인증
        • 인가
        • 인증
        • PasswordEncoder
      • IoC Container
      • Filter,Interceptor,AOP,Argument Resolver
      • Spring Annotation
      • About Spring
    • Kafka
      • Error Channel
    • Infra
      • Scale Up || Scale Out
      • Docker
        • Dockerfile
        • Docker Hub Deploy
        • Command
      • Cloud μœ ν˜•
        • Infrastructure as a Service
        • Platform as a Service
        • Software as a Service
      • 무쀑단 배포
        • μ—”μ§„μ—‘μŠ€(Nginx)
      • μ½”λ“œ μžλ™ 배포
        • Technical
      • AWS EC2
        • PEM(Privacy Enhanced Mail) ν‚€
      • AWS RDS
      • AWS S3
    • CodeSquad
      • Spring Boot Project 1μ£Όμ°¨ 회고
      • Spring Boot Project 2μ£Όμ°¨ 회고
      • Spirng Boot Project 3μ£Όμ°¨ 회고
      • Spring Boot Project 4μ£Όμ°¨ 회고
    • Foody Moody ν”„λ‘œμ νŠΈ
      • Query Performance Comparison
      • HeartCount Asynchronous Issue
      • DeferredResult
      • ResponseBodyEmitter
      • SseEmitter (Spring)
      • Server-Sent Events (SSE)
      • 기술 μŠ€νƒ 적용 이유
      • NO-CACHE(HTTP)
      • Transactional
    • DDD
      • AggregateId
    • Test
      • RestAssured
    • Coding and Algorithmic Problems
      • 819. Most Common Word
      • 344. Reverse String
      • 125. Valid Palindrome
      • 937. Reorder Data in Log Files
    • Node
      • Async... Await...
      • Custom Transactional Decorator Challenger
    • Python
      • Python Basic Grammar
        • Comments and Input/Output
        • Variable
        • Data type
        • Operations and syntax
        • List,Tuple,Dictionary,Set
        • Function
        • Conditional statement
        • Loop
    • HTML
      • HTML Basic
      • HTML Basic Tags
      • HTML Form Tags
      • HTML Table Tags
    • CSS
      • CSS Basic
      • CSS Practice
Powered by GitBook
On this page
  • Configuring An Inbound Channel Adapter
  • Configuring An Outbound Channel Adapter
  • Channel Adapter Expressions and Scripts

Was this helpful?

  1. 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
  2. Spring
  3. Spring Integration Overview

Channel Adapter

채널 μ–΄λŒ‘ν„°λŠ” 단일 λ°œμ‹ μž λ˜λŠ” μˆ˜μ‹ μžλ₯Ό λ©”μ‹œμ§€ 채널에 μ—°κ²°ν•  수 있게 ν•΄μ£ΌλŠ” λ©”μ‹œμ§€ μ—”λ“œν¬μΈνŠΈμ΄λ‹€.

Configuring An Inbound Channel Adapter

μΈλ°”μš΄λ“œ 채널 μ–΄λŒ‘ν„° μš”μ†Œ(μžλ°” κ΅¬μ„±μ˜ SourcePollingChannelAdapter)λŠ” Spring 관리 객체의 λͺ¨λ“  λ©”μ„œλ“œλ₯Ό ν˜ΈμΆœν•˜κ³  λ©”μ„œλ“œμ˜ 좜λ ₯을 Message둜 λ³€ν™˜ν•œ ν›„ null이 μ•„λ‹Œ λ°˜ν™˜ 값을 MessageChannel둜 보낼 수 μžˆμŠ΅λ‹ˆλ‹€.

μ–΄λŒ‘ν„°μ˜ ꡬ독이 ν™œμ„±ν™”λ˜λ©΄ pollerλŠ” μ†ŒμŠ€μ—μ„œ λ©”μ‹œμ§€ μˆ˜μ‹ μ„ μ‹œλ„ν•©λ‹ˆλ‹€.

pollerλŠ” 제곡된 ꡬ성에 따라 TaskScheduler둜 μ˜ˆμ•½λ©λ‹ˆλ‹€

κ°œλ³„ 채널 μ–΄λŒ‘ν„°μ— λŒ€ν•œ 폴링 간격 λ˜λŠ” cron ν‘œν˜„μ‹μ„ κ΅¬μ„±ν•˜λ €λ©΄ fixed-rate λ˜λŠ” cronκ³Ό 같은 일정 속성 쀑 ν•˜λ‚˜μ™€ ν•¨κ»˜ poller μš”μ†Œλ₯Ό μ œκ³΅ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ μ˜ˆμ—μ„œλŠ” 두 개의 μΈλ°”μš΄λ“œ 채널 μ–΄λŒ‘ν„° μΈμŠ€ν„΄μŠ€λ₯Ό μ •μ˜ν•©λ‹ˆλ‹€.

@Bean
public IntegrationFlow source1() {
    return IntegrationFlow.from(() -> new GenericMessage<>(...),
                             e -> e.poller(p -> p.fixedRate(5000)))
                ...
                .get();
}

@Bean
public IntegrationFlow source2() {
    return IntegrationFlow.from(() -> new GenericMessage<>(...),
                             e -> e.poller(p -> p.cron("30 * 9-17 * * MON-FRI")))
                ...
                .get();
}

Configuring An Outbound Channel Adapter

outbound-channel-adapter μš”μ†Œ(Java κ΅¬μ„±μš© @ServiceActivator)λŠ” ν•΄λ‹Ή μ±„λ„λ‘œ μ „μ†‘λœ λ©”μ‹œμ§€μ˜ νŽ˜μ΄λ‘œλ“œμ™€ ν•¨κ»˜ ν˜ΈμΆœλ˜μ–΄μ•Ό ν•˜λŠ” POJO μ†ŒλΉ„μž λ©”μ„œλ“œμ— MessageChannel을 μ—°κ²°ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ μ˜ˆλŠ” μ•„μ›ƒλ°”μš΄λ“œ 채널 μ–΄λŒ‘ν„°λ₯Ό μ •μ˜ν•˜λŠ” 방법을 λ³΄μ—¬μ€λ‹ˆλ‹€.

@Bean
public IntegrationFlow outboundChannelAdapterFlow(MyPojo myPojo) {
    return f -> f
             .handle(myPojo, "handle");
}

μ‘°μ • 쀑인 채널이 PollableChannel인 경우 λ‹€μŒ μ˜ˆμ œμ™€ 같이 poller ν•˜μœ„ μš”μ†Œ(@ServiceActivator의 @Poller ν•˜μœ„ 주석)λ₯Ό μ œκ³΅ν•΄μ•Ό ν•©λ‹ˆλ‹€.

public class MyPojo {

    @ServiceActivator(channel = "channel1", poller = @Poller(fixedRate = "3000"))
    void handle(Object payload) {
        ...
    }

}

Channel Adapter Expressions and Scripts

λ‹€λ₯Έ λ§Žμ€ Spring 톡합 ꡬ성 μš”μ†Œμ™€ λ§ˆμ°¬κ°€μ§€λ‘œ <inbound-channel-adapter>및 <outbound-channel-adapte>도 SpEL ν‘œν˜„μ‹ 평가λ₯Ό μ§€μ›ν•©λ‹ˆλ‹€.

Last updated 1 year ago

Was this helpful?