compiler-errors - Apache camel-该类型必须实现继承的抽象方法错误

标签 compiler-errors port apache-camel abstract

我已经在 Camel 周围闲逛了一段时间了。
我已经编写了这小段代码,可以转发所有传入的请求
在端口8080上到两个服务器vmxp22-sat-1:8080和vmxp22-sat-1:8080

import java.util.List;

import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.Endpoint;
import org.apache.camel.processor.loadbalancer.LoadBalancer;


public class Test implements LoadBalancer  {

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                // START SNIPPET: e1
                from("jetty://http://localhost:8080")
                .loadBalance().roundRobin()
                .to("http://vmxp22-sat-1:8080",
                    "http://vmxp22-sat-2:8080");
                // END SNIPPET: e1


            }
        };
    }
}

但是当我在 eclipse 上使它变得复杂时,我得到以下错误
The type Test must implement the inherited abstract method AsyncProcessor.process(Exchange, AsyncCallback)  Test.java   /first_camel/src/main/java/com/mycompany/first_camel    line 24 Java Problem
The type Test must implement the inherited abstract method LoadBalancer.addProcessor(Processor) Test.java   /first_camel/src/main/java/com/mycompany/first_camel    line 24 Java Problem
The type Test must implement the inherited abstract method LoadBalancer.getProcessors() Test.java   /first_camel/src/main/java/com/mycompany/first_camel    line 24 Java Problem
The type Test must implement the inherited abstract method LoadBalancer.removeProcessor(Processor)  Test.java   /first_camel/src/main/java/com/mycompany/first_camel    line 24 Java Problem
The type Test must implement the inherited abstract method Processor.process(Exchange)  Test.java   /first_camel/src/main/java/com/mycompany/first_camel    line 24 Java Problem

由于我是Java和Camel的新手,所以我发现很难对其进行梳理。

任何建议或帮助将不胜感激。

最佳答案

您的类(class)应该实现RouteBuilder,而不是LoadBalancer ...

有关详细信息,请参见http://camel.apache.org/routes.html

关于compiler-errors - Apache camel-该类型必须实现继承的抽象方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11866144/

相关文章:

ios - 从 CFData : Arithmetic on a pointer to incomplete type 读取像素字节

c++ - VC++ 说 "no overloaded function takes 7 arguments"我说是的!

tomcat - 我如何解决已在使用的 java.net.BindException 地址 : bind

apache-camel - Apache Camel : do Processors and Beans serve the same purpose?

apache-camel - Fuse ESB/OSGI/Blueprint 按字母顺序读取配置文件?

c++ - 为什么编译器在定义类似的模板特化时不会报错?

sql - SQL触发器存储过程编译错误

node.js - 在 nodejs 中为 server.listen() 重新使用相同的端口

java - jar 到 python 模块

java - 不从seda队列消费时如何用Camel释放文件锁?