You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrè <mo...@web.de> on 2011/07/01 12:39:47 UTC

Answer multiplication/ConnectionPooling/Whats that for ?

i read this about connection pooling http://camel.apache.org/activemq.html
 and efficient handling of connections sounds great, so i did it *g* (copy &
past)
but.. when testing like this (see at the end  of the post), my mock
(outputEndpoint) reveices 10 messages, which has to be the consequence of
that configuration. 

<property name="concurrentConsumers" value="10"/>

I have to confess that i dont know what it really does, but it seems to
connect 10 consumers which consume and also reply to that request, 

i thought of creating some kind thread pool, which will handle incoming
messages; like some kind of load balancing feature, ,, so is it something
like that and my configuration needs only to be elaboratd? , or did i
misunderstand that thing ..




	context.addRoutes(new RouteBuilder() {
			@Override
			public void configure() throws Exception {
				from("activemq:topic:services.global.xacml.*").to(
						outputEndpoint);
			}
		});
		
	
outputEndpoint.expectedBodiesReceived(getFileContent("src/main/resources/requests/request.xml"));
		XacmlAuthzService authzService = context.getRegistry().lookup(
				"Xacml_AuthZ_Service", XacmlAuthzService.class);
		String response = authzService
			
.evalAuthzRequest(getFileContent("src/main/resources/requests/request.xml"));
		// Wait for camel/amq ..
		Thread.sleep(1000);
		assertEquals(xacmlResponse, response);
		outputEndpoint.assertIsSatisfied();

--
View this message in context: http://camel.465427.n5.nabble.com/Answer-multiplication-ConnectionPooling-Whats-that-for-tp4541717p4541717.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Answer multiplication/ConnectionPooling/Whats that for ?

Posted by boday <be...@initekconsulting.com>.
As Ashwin said, you are mixing things a bit.... 

when using a topic, you only want a single concurrent consumer or you will
get duplicates.  you can either change the overall JMS Config (used by all
routes) or explicitly set these on any routes in question...

rom("activemq:topic:services.global.xacml.*?maxConcurrentConsumers=1&concurrentConsumers=1").to(outputEndpoint);
")



Andrè wrote:
> 
> i read this about connection pooling http://camel.apache.org/activemq.html
>  and efficient handling of connections sounds great, so i did it *g* (copy
> & past)
> but.. when testing like this (see at the end  of the post), my mock
> (outputEndpoint) reveices 10 messages, which has to be the consequence of
> that configuration. 
> 
> <property name="concurrentConsumers" value="10"/>
> 
> I have to confess that i dont know what it really does, but it seems to
> connect 10 consumers which consume and also reply to that request, 
> 
> i thought of creating some kind thread pool, which will handle incoming
> messages; like some kind of load balancing feature, ,, so is it something
> like that and my configuration needs only to be elaboratd? , or did i
> misunderstand that thing ..
> 
> 
> 
> 
> 	context.addRoutes(new RouteBuilder() {
> 			@Override
> 			public void configure() throws Exception {
> 				from("activemq:topic:services.global.xacml.*").to(
> 						outputEndpoint);
> 			}
> 		});
> 		
> 	
> outputEndpoint.expectedBodiesReceived(getFileContent("src/main/resources/requests/request.xml"));
> 		XacmlAuthzService authzService = context.getRegistry().lookup(
> 				"Xacml_AuthZ_Service", XacmlAuthzService.class);
> 		String response = authzService
> 			
> .evalAuthzRequest(getFileContent("src/main/resources/requests/request.xml"));
> 		// Wait for camel/amq ..
> 		Thread.sleep(1000);
> 		assertEquals(xacmlResponse, response);
> 		outputEndpoint.assertIsSatisfied();
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Answer-multiplication-ConnectionPooling-Whats-that-for-tp4541717p4542448.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Answer multiplication/ConnectionPooling/Whats that for ?

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

You seem to be mixing concerns in your message. Connection Pooling has
nothing to do with Load Balancing.

Connection Pooling is a way to prevent constant recycling of connection
objects and thereby gaining performance and capacity in dealing with high
message throughput.

Load Balancing is entirely separate. The Broker simply dispatches messages
on a connection that has  capacity available in the consumer prefetch
against a given consumer using the connection. The broker can be directed to
spread the load (aka load balance) using a broker dispatch policy (
http://activemq.apache.org/dispatch-policies.html
http://activemq.apache.org/dispatch-policies.html ) which is configured on
the broker not on a camel route consumer that uses an pooled ActiveMQ
connection factory.

Hope this helps.

Cheers,

Ashwin... 

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Answer-multiplication-ConnectionPooling-Whats-that-for-tp4541717p4542112.html
Sent from the Camel - Users mailing list archive at Nabble.com.