Camel 在SEDA上设置queueSize选项

9wbgstp7  于 2022-11-07  发布在  Apache
关注(0)|答案(4)|浏览(211)

我有一个seda队列,其中我根据camel documentation设置了queueSize选项
我的路线看起来像:

from("seda:someQueue?concurrentConsumers=10&queueSize=10")
.process(someProcessor);

由于queueSize选项,我收到以下错误:
创建路由失败异常:无法创建路由.... bla bla bla..有1个参数无法在终结点上设置。请检查URI中的参数拼写是否正确,以及它们是否为终结点的属性。未知参数=[{queueSize=10}].....[stacktrace在此处继续]
有人能指出哪里出了问题吗?我用的是Java8,Camel2.9.13

mrzz3bfm

mrzz3bfm1#

注意文档中说queueSize选项是componentonly,这意味着你需要在SedaComponent上配置它,换句话说,你不能像在上面的路由中那样在端点上配置它。
要获得关于Camel组件的最新文档和更好的文档,请浏览github页面:https://github.com/apache/camel/blob/master/components/camel-seda/src/main/docs/seda-component.adoc
这些文档是最新的,并在不同的表格中显示了组件和端点选项,因此更容易了解差异。

v1uwarro

v1uwarro2#

对于那些有同样问题的人,这是我现在使用queueSize的方式
初始化新的seda组件,

SedaComponent sedaComponent = new SedaComponent();
        sedaComponent.setQueueSize(3);
        context.addComponent("sedaComponent", sedaComponent);

然后在路由中使用该组件,

from("seda:someEndPoint?concurrentConsumers=5")
                             .to("sedaComponent:someOtherSedaEndPoint?blockWhenFull=true");
3qpi33ja

3qpi33ja3#

创建一个特定的队列。这是quarkus示例replace命名为bean和应用程序作用域为Sping Boot 的配置

@ApplicationScoped
public  class ConnectionConf {

    @Named("NonLimitQueue")
    @Produces
    public BlockingQueue arrayDeque(){
        return new ArrayBlockingQueue(30000);
    }
}

驼面

from("seda:queue=#NonLimitQueue")
            .convertBodyTo(String.class).log("${body}")
ruyhziif

ruyhziif4#

queueSize替换为

size(query param in apache document)
    from("seda:someQueue?concurrentConsumers=10&queueSize=10")
.process(someProcessor);

相关问题