Message Endpoints
Last updated
Was this helpful?
Last updated
Was this helpful?
๋ฉ์์ง ๋ณํ๊ธฐ๋ ๋ฉ์์ง์ ๋ด์ฉ์ด๋ ๊ตฌ์กฐ๋ฅผ ๋ณํํ๊ณ ์์ ๋ ๋ฉ์์ง๋ฅผ ๋ฐํํ๋ ์ญํ ์ ํฉ๋๋ค.
๋ฉ์์ง ํํฐ๋ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅ ์ฑ๋๋ก ์ ๋ฌํด์ผ ํ๋์ง ์ฌ๋ถ๋ฅผ ๊ฒฐ์ ํฉ๋๋ค.
๋ฉ์์ง ํํฐ๋ ์ฌ๋ฌ ์๋น์๊ฐ ๋์ผํ ๋ฉ์์ง๋ฅผ ์์ ํ๊ณ ํํฐ ๊ธฐ์ค์ ์ฌ์ฉํ์ฌ ์ฒ๋ฆฌํ ๋ฉ์์ง ์งํฉ์ ๋ฒ์๋ฅผ ์ขํ ์ ์๋ publish-subscribe channel๊ณผ ํจ๊ป ์ฌ์ฉ๋๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค.
๋ฉ์์ง ๋ผ์ฐํฐ๋ ๋ค์์ ๋ฉ์์ง๋ฅผ ์์ ํด์ผ ํ๋ ์ฑ๋(์๋ ๊ฒฝ์ฐ)์ ๊ฒฐ์ ํด์ผ ํฉ๋๋ค.
์ผ๋ฐ์ ์ผ๋ก ๋ฉ์์ง ๋ด์ฉ ๋๋ ๋ฉ์์ง ํค๋์์ ์ฌ์ฉ ๊ฐ๋ฅํ ๋ฉํ๋ฐ์ดํฐ์ ๋ฐ๋ผ ๊ฒฐ์ ๋ฉ๋๋ค.
๋ฉ์์ง ๋ผ์ฐํฐ๋ ํ์ ๋ฉ์์ง๋ฅผ ๋ณด๋ผ ์ ์๋ ์๋น์ค ์กํฐ๋ฒ ์ดํฐ ๋๋ ๊ธฐํ ์๋ํฌ์ธํธ์์ ์ ์ ์ผ๋ก ๊ตฌ์ฑ๋ ์ถ๋ ฅ ์ฑ๋์ ๋ํ ๋์ ๋์์ผ๋ก ์์ฃผ ์ฌ์ฉ๋ฉ๋๋ค.
์คํ๋ฆฌํฐ๋ ์ ๋ ฅ ์ฑ๋์์ ๋ฉ์์ง๋ฅผ ์๋ฝํ๊ณ ํด๋น ๋ฉ์์ง๋ฅผ ์ฌ๋ฌ ๋ฉ์์ง๋ก ๋ถํ ํ๊ณ ๊ฐ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅ ์ฑ๋๋ก ๋ณด๋ด๋ ๋ ๋ค๋ฅธ ์ ํ์ ๋ฉ์์ง ๋์ ์ ๋๋ค
์ ๊ทธ๋ฆฌ๊ฒ์ดํฐ๋ ์ฌ๋ฌ ๋ฉ์์ง๋ฅผ ์์ ํ์ฌ ๋จ์ผ ๋ฉ์์ง๋ก ๊ฒฐํฉํ๋ ์ผ์ข ์ ๋ฉ์์ง ์๋ํฌ์ธํธ์ ๋๋ค.
Service Activator๋ ์๋น์ค ์ธ์คํด์ค๋ฅผ ๋ฉ์์ง ์์คํ ์ ์ฐ๊ฒฐํ๊ธฐ ์ํ ์ผ๋ฐ ๋์ ์ ๋๋ค.
์ฑ๋ ์ด๋ํฐ๋ ๋ฉ์์ง ์ฑ๋์ ๋ค๋ฅธ ์์คํ ์ด๋ ์ ์ก์ ์ฐ๊ฒฐํ๋ ๋์ ์ ๋๋ค.
์๋น ์๋ํฌ์ธํธ(inputChannel์ด ์๋ ๋ชจ๋ ๊ฒ)๋ consumer์ message ํธ๋ค๋ฌ๋ผ๋ ๋ ๊ฐ์ ๋น์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค.
์์ ์์์ bean ์ด๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค
Consumer: someService
(the id
)
Handler: someService.handler
์์ ์์์ bean ์ด๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค
Consumer: someComponent.someMethod.serviceActivator
Handler: someComponent.someMethod.serviceActivator.handler
@EndpointId
์ฃผ์์ ์ฌ์ฉํ์ฌ ์ด๋ฌํ ์ด๋ฆ์ ์์ ํ ์ ์์ต๋๋ค.์์ ์์์ bean ์ด๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
Consumer: someService
Handler: someService.handler
@EndpointId
๋ XML ๊ตฌ์ฑ์ ์ฌ์ฉํ์ฌ id ์์ฑ์ ์ํด ์์ฑ๋ ์ด๋ฆ์ ์์ฑํฉ๋๋ค.์์ ์์์ bean ์ด๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
Consumer: someConfiguration.someHandler.serviceActivator
Handler: someHandler
(the @Bean
name)
์์ ์์์ bean ์ด๋ฆ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
Consumer: someService
(the endpoint ID)
Handler: someService.handler
(the bean name)
SourcePollingChannelAdapter
)์ MessageSource
๋ผ๋ ๋ ๊ฐ์ ๋น์ ์์ฑํฉ๋๋คGiven the preceding XML configuration, the bean names are as follows:
SPCA: someAdapter
(the id
)
Handler: someAdapter.source
@EndpointId
Given the preceding Java configuration example, the bean names are as follows:
SPCA: someAdapter
Handler: someAdapter.source
@EndpointID
:Given the preceding example, the bean names are as follows:
SPCA: someAdapter
Handler: someAdapter.source
(as long as you use the convention of appending .source
to the @Bean
name)