0

Hi I write my custom camel component and it is working until I upgrade the version. I uprade my version 3.1 to 3.2 but I got error

 Resolved [org.apache.camel.NoSuchEndpointException: No endpoint could be found for: my-rest-client, please check your classpath contains the needed Camel component jar.]

I check to camel documentation but not understand clearly.

https://camel.apache.org/manual/latest/camel-3x-upgrade-guide-3_2.html

I try something but nothing change This is not working

  //camelContext.getRestConfiguration("servlet",true); 3.1 code deleted to upgrade 3.2
            CamelContextHelper.getRestConfiguration(camelContext,"servlet"); 3.2

I try to add camel-http,camel-direct to my pom but no effected.

Component("MYClientEndpoint")
@UriEndpoint(scheme = "my-rest-client",title = "my-rest-client",syntax = "my-rest-client")
public class MYClientEndpoint extends DefaultEndpoint {
    @Autowired
    private MYClientProducer MYClientProducer;
    @Override
    public Producer createProducer() {
        return MYClientProducer;
    }

    @Override
    public Consumer createConsumer(Processor processor) {
        throw new UnsupportedOperationException("Operation not supported");
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public String getEndpointUri() {
        return "my-rest-client";
    }
}

It can exist in my application context already.I can access when Autowired it

Bilgehan
  • 1,135
  • 1
  • 14
  • 41
  • You need to provide some more information about your route and set-up. – Luca Burgazzoli Sep 20 '21 at 17:49
  • @LucaBurgazzoli I added my endpoint definition.camelContext.getEndpoints().add(myRestClientEndpoint); I try to add manuely.It passed this step but when try to call producer send I got nosuch endpoint – Bilgehan Sep 21 '21 at 14:35
  • 1
    I'd recommend to use the latest version of camel (3.11.x) and to create a full component (https://camel.apache.org/manual/latest/writing-components.html) as here it appears the endpoint is not instantiate by a component. I also recommend creating a reproducer. – Luca Burgazzoli Sep 23 '21 at 04:23

1 Answers1

0

I found answer when I change getEndpointUri method return value and equialize it to my endpointbeanname that time it start to work in camel 3.11 Another approach is add enpoint to camel starter context with new name at the beginning.

Component("MYClientEndpoint")
public class MYClientEndpoint

@Override
    public String getEndpointUri() {
        return "my-rest-client";--> I change to  return "MYClientEndpoint"
    }
Bilgehan
  • 1,135
  • 1
  • 14
  • 41