1

ここに書かれている方法でノーマライザーを実装しようとしています: http://camel.apache.org/normalizer.html

私はこの例外を受けています:

org.apache.camel.NoSuchBeanException: No bean could be found in the registry for
: normalizer

RouteBuilder の .configure() は次のようになります。

public void configure() throws Exception {

    JndiContext context = new JndiContext();
    context.bind("normalizer", new MyNormalizer());

    CamelContext camelContext = new DefaultCamelContext(context);
    camelContext.addRoutes(this);

    from("activemq:queue:input.splitter")
            .split().tokenizeXML("person").streaming()
            .to("activemq:queue:output.splitter");

    from("activemq:queue:input.normalizer")
            .choice()
            .when().xpath("//persons/person/position").to("bean:normalizer?method=positionChange")
            .end()
            .to("activemq:queue:output.normalizer");

}

ノーマライザーは次のようになります。

public class MyNormalizer {
    public void positionChange(Exchange exchange, @XPath("//persons/person/position") String name) {
        exchange.getOut().setBody(createPerson(name));
    }

    private String createPerson(String name) {
        return name;
    }
}

そのコードを RouteBuilder に追加する方法について、1 つの解決策を見つけました。

JndiContext context = new JndiContext();
context.bind("normalizer", new MyNormalizer());

CamelContext camelContext = new DefaultCamelContext(context);

しかし、結果は出ませんでした。では、ここで何が問題になるのでしょうか?

4

1 に答える 1