On Mon, 2010-05-24 at 15:43 -0400, Sachin Nikumbh wrote: > Hi, > > I want to implement an http client that supports non-blocking server calls. I > know that httpclient does not support non-blocking calls. So, I have started > off with going through the httpcore document. I am in search of some document > that will describe the differences/relation between these 2 components. A > document that will answer the basic question of "how to decide whether I > should use httpclient or httpcore" would be useful. Is there any > architectural diagram where httpclient and httpcore dependencies are made > clear? > > There's a lot of information on the Apache web site, I just want to be > pointed in the right direction. > > I have tried searching through the archive but couldn't find anything. > > Thanks > Sachin
Sachin, First off, you need to ask yourself whether you really need asynchronous HTTP client based on the non-blocking I/O model. Contrary to a very common misconception NIO is significantly slower than blocking I/O as long as the number of simultaneous connections is less than several thousands. Asynchronous I/O is also significantly more complex than blocking I/O and implies a completely different programming model based on callbacks / events. In most cases using dedicated worker threads to execute HTTP requests will be a lot faster and simpler. If you are convinced you need fully asynchronous HTTP client handler, then the best way to start is by familiarizing yourself with HttpCore NIO tutorial http://hc.apache.org/httpcomponents-core-4.0.1/tutorial/html/nio.html There is also an experimental async HTTP client implementation based on HttpCore NIO. It is still very basic and not even ALPHA quality but something you might want to check out: http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/ Hope this helps Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
