在与Oleg的讨论中,对问题进行了大量编辑
我正在尝试在Spring Cloud Stream中为BigQuery实现一个绑定器。
qazxsw poi提供完整的申请代码。
到目前为止,我已经写了一个GitHub类,它以下列方式返回BigQueryBinderConfiguration
BigQueryBinder
我的问题是,当这样做时,我的其他绑定器(Rabbit和Kafka)不再被识别。
我的测试协议如下:如果我的应用程序注册为消费者,我启动我的应用程序并检查rabbitmq管理界面。取消注释此代码时不会出现这种情况。
调试@Configuration @EnableConfigurationProperties({ BigQueryConfiguration.class })
public class BigQueryBinderConfiguration {
@Autowired BigQueryConfiguration configuration;
@Bean
BigQueryBinder bigQueryMessageChannelBinder(BigQueryConfiguration configuration, BigQueryProvisioningProvider provisioningProvider) {
return new BigQueryBinder(configuration, provisioningProvider);
}
@Bean BigQueryProvisioningProvider provisioningProvider() {
return new BigQueryProvisioningProvider(configuration);
}
}
时,我会观察到以下情况。
bigQueryMessageChannelBinder(....)
方法总是返回我的BigQueryBinder实例。调试表明对DefaultBinderFactory#getBinder(...)
的调用返回一个仅包含我的BigQueryBinder的列表。我很困惑,因为其他绑定器都在我的类路径中,如果我删除工厂方法this.context.getBeansOfType(Binder.class);
,一切正常。
我在调试期间发现BigQueryBinderConfiguration#bigQueryMessageChannelBinder(....)
是用于将绑定器与配置名称相关联的类。我还发现Binder实现不应该出现在DefaultBinderFactory
中。但不幸的是,我的Binder实现出现在该列表中。我想这与豆的性质有关。但是怎么样?
我认为你能做的最好的事情就是首先看看我们新的Map<String, Binder> binders
。基本上它是由Spring Integration支持的完整版本。换句话说,Spring Integration和它的渠道扮演消息经纪人的角色,同样是Rabbit,Kafka,GCP和其他绑定器。这个活页夹的重要之处在于它有效地展示了实现功能性活页夹所需的最低限度。
根据本期TestChannelBinder.java的对话。
我想从/向Spring Cloud Stream通道使用/生成消息到Axon Framework的内部事件总线。
这张照片中的模型是否正确?
如果它是正确的,我认为我们应该通过注入bean或其他方法在自定义绑定器中使用Stream中的通道。
在Application model with internal and external binder类中,通过调用构造函数,如何在自定义绑定器中使用Spring Cloud Stream管理的通道,在用户代码中创建了通道?
TestChannelBinder