- 让我们从这里开始:[https](https://docs.spring.io/spring-
- integration/docs/5.0.9.RELEASE/reference/html/overview.html#programming-tips)
- //docs.spring.io/spring-
integration/docs/5.0.9.RELEASE/reference/html/overview.html#programming-
tips
借助XML配置和Spring
Integration命名空间的支持,XML解析器隐藏了如何声明目标bean并将它们连接在一起。对于Java和注释配置,了解用于目标最终用户应用程序的framework
API非常重要。
然后我们为此打开一个XSD
<int-redis:queue-inbound-channel-adapter>:
<xsd:element name="queue-inbound-channel-adapter"> <xsd:annotation> <xsd:documentation> Defines a Message Producing Endpoint for the 'org.springframework.integration.redis.inbound.RedisQueueMessageDrivenEndpoint' for listening a Redis queue. </xsd:documentation> </xsd:annotation>
因此,听起来a
int-redis:queue-inbound-channel-adapter不是
MessageSource。因此
@InboundChannelAdapter是死胡同。我同意XML元素的名称当时是错误的,但是重命名它为时已晚。
从这里我们也已经弄清楚我们需要处理这个问题
RedisQueueMessageDrivenEndpoint。并且由于它是 消息驱动的
,自我管理的,因此我们不需要任何特殊的注释。足以将其声明为如下所示的bean:
@BeanRedisQueueMessageDrivenEndpoint redisQueueMessageDrivenEndpoint(RedisConnectionFactory redisConnectionFactory, RedisSerializer<?> serializer) { RedisQueueMessageDrivenEndpoint endpoint = new RedisQueueMessageDrivenEndpoint("archive.post.publication.queue", redisConnectionFactory); endpoint.setOutputChannelName("postPublicationChannel"); endpoint.setErrorChannelName("postPublicationLoggingChannel"); endpoint.setReceiveTimeout(5000); endpoint.setSerializer(serializer); return endpoint;}


