Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 47795 invoked from network); 21 Mar 2008 05:06:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Mar 2008 05:06:23 -0000 Received: (qmail 16991 invoked by uid 500); 21 Mar 2008 05:06:20 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 16973 invoked by uid 500); 21 Mar 2008 05:06:20 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 16964 invoked by uid 99); 21 Mar 2008 05:06:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 22:06:20 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ankurdotshah@gmail.com designates 72.14.220.157 as permitted sender) Received: from [72.14.220.157] (HELO fg-out-1718.google.com) (72.14.220.157) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Mar 2008 05:05:32 +0000 Received: by fg-out-1718.google.com with SMTP id d23so1007938fga.32 for ; Thu, 20 Mar 2008 22:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=NoxuUWGTEuYci6i0abFgo376OjGZgaKnhCVYGbFKs4c=; b=e78yyOu5WZFl8pNm06+QHqcpFS1E0p1s8XnEx3wbkUi6pJ8f5BdXXxI4ktT3aHSbWwf/+TaC1aihEnWkk4dhcESs+NN4/sRlkfseQ2NwfsrTWz49banic4KcBMXVoVnQ6zM59vz3/yrLNOKNM95u9su7tv3uGm/kxEkXzWDyoxU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type; b=mTa11qPM6xpevdWA2/USlTwTdINVy0ri+63OlA4tiqJobdTbhPLihor5OgYOI0p/o3ysY17UGMaNE/2OaCAwog+RmsnnWnAC+sPCM1gLGaIbooxKVdsB4ukII01zr9oA8Z0b40pBwQkFbN8zgVFaNph7njTlqn4Ao8zEbqqMW4g= Received: by 10.82.148.7 with SMTP id v7mr6230286bud.37.1206075953151; Thu, 20 Mar 2008 22:05:53 -0700 (PDT) Received: by 10.82.189.12 with HTTP; Thu, 20 Mar 2008 22:05:53 -0700 (PDT) Message-ID: <3f306a1b0803202205s218840a1i2299911c3edf4c62@mail.gmail.com> Date: Thu, 20 Mar 2008 22:05:53 -0700 From: "Ankur Shah" To: httpclient-users@hc.apache.org Subject: Apache HttpClient - Using custom socket factory for failover support MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2425_30970709.1206075953144" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_2425_30970709.1206075953144 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I am using httpclient to connect to a remote server. Now for each primary server there's also a backup failover server that i must talk to if connection attempts with the primary server fails. To achieve this what i'd ideally like to do is have HttpClient use a custom factory that tries to create a socket connection with the primary server and if that fails (or times out), it'll go about talking to backup server (and retry a few times before giving up altogether). Now, searching on the web, i did find references to a MultiHomeProtocolSocketFactory (that extends DefaultSocketFactory) that is presumably in apache contrib package. But what that does is that in the overriden createSocket method, it takes host as a param (among other thing) and then simply does a InetAddress.getAllByName which is not what i want. From what i understand this caters to a DNS based failover which is not the case here. What i'd ideally like to do is create a factory and have a createSocket method that takes primary and secondary host and port as args and then tries both. I am not sure though how can i make HttpConnection class invoke my method. ------=_Part_2425_30970709.1206075953144--