java - Can multiple camel routes cause a very large number of threads? -
i clarify question.
i have task integrate 2 systems: frontend serving html , backend gives data frontend. backend have large rest api have use multiple routes. planned use single camel context , wrap routes it.
<camelcontext xmlns="http://activemq.apache.org/camel/schema/spring"> <from uri="direct:data"/> <to uri="ahc:http://localhost/data"/> <!--and on. more 70 routes--> </camelcontext>
then, planned invoke route using @produce annotation on service method adviced in hiding middleware article
public interface service { string data(); } public class mybean { @produce(uri = "direct:data") protected service producer; public void dosomething() { // lets send message string response = producer.data(); } }
as understand information taken here , here i'll end additional 70 thread in app (one each route). fear can cause serious performance hit , while backend api grow thread number grow it. correct? how can avoid if it's true? understand, can't employ executorservice thread pool in case.
thanks in advance answer.
no not end thread per route. threading module tied threading model of consumer (eg route input).
for example route uses timer component use scheduled thread pool (1 thread). , jms component use 1 or more threads, depending on if set concurrentconsumers=n, etc.
the direct component direct method invocation , uses caller thread, there 0 new threads threading model.
if 70 routes uses ahc in < > may want re-use same endpoint, reuse thread pool of ahc library. or alternative configure shared pool used ahc endpoints.
and btw question posted on camel user forum / mailinglist: http://camel.465427.n5.nabble.com/can-multiple-camel-routes-cause-a-very-large-number-of-threads-tp5736620.html
Comments
Post a Comment