W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
Binder SPI由許多接口,現(xiàn)成的實用程序類和發(fā)現(xiàn)策略組成,這些策略提供了用于連接到外部中間件的可插拔機制。
SPI的關鍵是Binder
接口,這是將輸入和輸出連接到外部中間件的策略。以下清單顯示了Binder
接口的定義:
public interface Binder<T, C extends ConsumerProperties, P extends ProducerProperties> { Binding<T> bindConsumer(String name, String group, T inboundBindTarget, C consumerProperties); Binding<T> bindProducer(String name, T outboundBindTarget, P producerProperties); }
該接口已參數(shù)化,提供了許多擴展點:
MessageChannel
,但將來打算將其用作擴展點。典型的活頁夾實現(xiàn)包括以下內(nèi)容:
Binder
接口的類;@Configuration
類,它創(chuàng)建類型為Binder
的bean和中間件連接基礎結(jié)構(gòu)。在類路徑上找到一個META-INF/spring.binders
文件,其中包含一個或多個綁定程序定義,如以下示例所示:
kafka:\ org.springframework.cloud.stream.binder.kafka.config.KafkaBinderConfiguration
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: