Reputation: 83
Can i write my own Processor Definition methods in Camel and use that in my route as below ?
from(uri)
.to("http://host:port/testData")
.**setTimeOut(long milliseconds)**
from is implemented in RouteDefinition and to is implemented in ProcessorDefinition. Like that if i want to implement setTimeOut method and use it in java DSL, how can i do that?
PS : I don't want to pass the timeOut as a Httpclient query parameter to HttpUri.
Can anyone help on this ?
Upvotes: 4
Views: 1122
Reputation: 55750
No you cannot do this.
The methods / eips you can use form the Java DSL is fixed. To extend this requires to extend the RouteBuilder
which allows to add new methods to new starting methods. You cannot add a setTimeOut
that can work together with to
, etc.
You would need to add the code to camel-core, and recompile it, which is not recommended.
However you can implement a processor, and then name it setTimeout, and then use the .process
Processor setTimeout = new MySetTimeout(1000);
from
.to
.process(setTimeout);
And then use it as a processor from the .process
method.
Upvotes: 3