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?

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top