2016-08-15 12 views
-2

私はラクダでkafkaエンドポイントを設定しています。ラクダでKAFKAエンドポイントを設定する

public class KAFKAConsumer extends RouteBuilder{ 

    private final String URLSEPARATOR = "&"; 

    @Autowired 
    private RouteProperties routeProperties; 

    MyClass entity = new MyClass(); 
    @Override 
    public void configure() throws Exception { 
     from("kafka:"+routeProperties.getRouteEndPoint()+URLSEPARATOR 
       +"topic="+routeProperties.getTopic()+URLSEPARATOR+"groupId="+routeProperties.getGroupId()+URLSEPARATOR 
       +"serializerClass=org.springframework.integration.kafka.serializer.avro.AvroSerializer" 
       ).routeId("MyMessage").unmarshal().avro(routeProperties.getSchemaName()).convertBodyTo(MyClass.class).bean(entity) 
     .process(new KafkaCamelProcessor()).log("Call web service....."); 
    } 

} 

しかし、私はカフカエンドポイントを構成する際にハードコーディングがたくさんあることがよくわかりません。次のクラスを使用して、私のkafkaエンドポイントをラクダで構成し、このクラスのすべてのエンドポイントプロパティを提供し、ラクダと統合できるようにするにはどうすればよいですか?

org.apache.camel.component.kafka.KafkaEndpoint 

答えて

0

は、このようなエンドポイントを設定する方法として、キャメルのマニュアルを参照してください:http://camel.apache.org/how-do-i-configure-endpoints.html

+0

私はすでにそれを見ました。コードを教えてもらえますか?それは私にとって大きな助けになるだろう – rishi

関連する問題