【问题标题】:Factory class for spring-integration-redis componentsspring-integration-redis 组件的工厂类
【发布时间】:2016-08-10 02:03:20
【问题描述】:

我正在使用 redis 列表在我的集成应用程序中像队列一样执行,如下所示:

    @Override
protected IntegrationFlowDefinition<?> buildFlow() {
    return this.from(this.redisQueueInboundGateway())
               .handle(...);
}

@Bean
RedisQueueInboundGateway redisQueueInboundGateway() {
    RedisQueueInboundGateway redisQueueInboundGateway = new RedisQueueInboundGateway(Queues.QUEUE_NAME, this.connectionFactory);

    redisQueueInboundGateway.setSerializer(genericJackson2JsonRedisSerializer);

    return redisQueueInboundGateway;
}

Spring Integration Java DSL中有没有像AMQP这样的工厂类来实现这个?

【问题讨论】:

    标签: spring spring-integration


    【解决方案1】:

    我们根据需要为目标协议添加这些工厂。

    尽管如您所见,这些 Redis 适配器使用起来非常简单,并且在您的定义中这样做非常正确。

    只有一条评论:即使您从 redisQueueInboundGateway() 方法中删除 @Bean 并使其变为 private,它也将起作用。 Spring Integration Java DSL 引擎将为您处理 bean 填充和初始化。

    请随时就此事提出GitHub issue!

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-09
    • 2022-08-18
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2019-04-30
    • 2019-04-29
    • 2010-10-27
    相关资源
    最近更新 更多