Camel custom component: perform two different actions

I just want to know if I can do below pertaining to custom component

1) I created a sample component

somComponent://foo ---> what this foo refers to?can i have any string there?
 What does it denotes?

2) consider below route

   from("some blah")
   .to(someCustomComponent://action1)
   .to(someCustomComponent://action2);

Idea - I want to perform two different actions on the above. Kind of two different methods.

Is the above possible?

Answers


The notation for your custom component in Apache Camel can be described as follows:

someComponent://instance?parm1=foo&parm2=bar

The instance part can be pretty much anything you want to uniquely identify the endpoint.

You can derive DefaultComponent and implement the methods. The signature for createEndpoint method looks like this:

protected Endpoint createEndpoint(final String uri, String remaining,
        Map<String, Object> parameters) throws Exception

So for the endpoint someComponent://instance?parm1=foo&parm2=bar

uri = someComponent://instance?parm1=foo&parm2=bar
remaining = instance
parmeters = (Map) parm1 -> foo, parm2 -> bar

Therefore, yes! You can easily denote the action you want, for example as a parameter such as:

someComponent://instance?action=something

Need Your Help