git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please correct ids to be unique among all your routes.


Hi,

if I try to build this code:

package org.mycompany;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;


public class MyFirstRouterBuilder extends RouteBuilder {
     @Override
    public void configure() throws Exception {
        try{
        restConfiguration().component("servlet");
            rest()
            .get("/accounts/{accountId}/transactions").id("r1")
                .param()
                    .name("accountId")
                    .type(RestParamType.path)
                    .dataType("string")
                    .required(true)
                .endParam()
                .to("direct:rest1");
 
                from("direct:rest1")
                 .log("${body}");
 
        }catch(Exception e){

        }
     }
}

I receive: 

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route r1 
because of duplicate id detected: r1. Please correct ids to be unique 
among all your routes.

If I add .routeId("r2") or .id("r2") to the second route, immediately 
after from("direct:rest1"), nothing changes.

If I remove .id("r1") from the rest get operation, I receive:

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route route1 
because of duplicate id detected: route2. Please correct ids to be unique 
among all your routes.

How is this supposed to be written in order to avoid that error?
I inject that into camel context like this:

    <bean class="org.mycompany.MyFirstRouterBuilder" id="myFirstRouter"/>
    <camelContext id="camel" useBreadcrumb="false" xmlns="
http://camel.apache.org/schema/spring";>
        <routeBuilder ref="myFirstRouter"/>
    </camelContext>
______________________

Napomena:
Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih problema prilikom dostave ove poruke.

Disclaimer:
This e-mail message and any attachment may contain confidental and/or privileged information and is intended for use by the indicated addressee only. If you have received this message in error, please notify the sender immediately, destroy the original message and any attachment and delete this message and any attachment from your system. Unauthorized use, distribution, disclosure, reproduction, or alteration of this e-mail message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts legally binding statements via e-mail unless otherwise stated. Considering that internet communication is not secured, Raiffeisenbank Austria d.d. is not responsible for the content of this message, for potential damage occured due to infection of this message with a virus or other malicious program, and for potential technical problems during delivery of this message.