Adding docs explaining thrift connection strings and how to get thrift clients.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/da43794f Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/da43794f Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/da43794f Branch: refs/heads/master Commit: da43794ffe6d2cb304d2e216e41b443ee6b847c7 Parents: da380c1 Author: Aaron McCurry <[email protected]> Authored: Thu Aug 29 19:24:35 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Thu Aug 29 19:24:35 2013 -0400 ---------------------------------------------------------------------- docs/using-blur.base.html | 51 ++++++++++++++++++++++++++++++++++++++++++ docs/using-blur.html | 51 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/da43794f/docs/using-blur.base.html ---------------------------------------------------------------------- diff --git a/docs/using-blur.base.html b/docs/using-blur.base.html index 35e70cc..1064858 100644 --- a/docs/using-blur.base.html +++ b/docs/using-blur.base.html @@ -86,9 +86,60 @@ The following examples are of using the Thrift API directly. You will need to f <li>log4j-1.2.15.jar</li> </ul> + + <div class="bs-callout bs-callout-info"><h4>Note</h4>Other versions of these libraries could work, but these are the versions that Blur currently uses.</div> </p> + +<h3 id="simple_connection_example">Getting A Client Example</h3> +<p> +<h4>Connection String</h4> +The connection string can be parsed or constructed through "Connection" object. If you are using the +parsed version there are some options. At a minimum you will have to provide hostname and port: +<pre><code class="bash">host1:40010</code></pre> + +You can list multiple hosts: +<pre><code class="bash">host1:40010,host2:40010</code></pre> + +You can add a SOCKS proxy server for each host: +<pre><code class="bash">host1:40010/proxyhost1:6001</code></pre> + +You can also add a timeout on the socket of 90 seconds (the default is 60 seconds): +<pre><code class="bash">host1:40010/proxyhost1:6001#90000</code></pre> + +Multiple hosts with a different timeout: +<pre><code class="bash">host1:40010,host2:40010,host3:40010#90000</code></pre> + +Here is all options together: +<pre><code class="bash">host1:40010/proxyhost1:6001,host2:40010/proxyhost1:6001#90000</code></pre> + +<h4>Thrift Client</h4> +Client Example 1: +<pre><code class="java">Iface client = BlurClient.getClient("controller1:40010,controller2:40010");</code></pre> + +Client Example 2: +<pre><code class="java">Connection connection = new Connection("controller1:40010"); +Iface client = BlurClient.getClient(connection);</code></pre> + +Client Example 3: +<pre><code class="java">BlurClientManager.execute("controller1:40010,controller2:40010", new BlurCommand<T>() { + @Override + public T call(Client client) throws BlurException, TException { + // your code here... + } +});</code></pre> + +Client Example 4: +<pre><code class="java">List<Connection> connections = BlurClientManager.getConnections("controller1:40010,controller2:40010"); +BlurClientManager.execute(connections, new BlurCommand<T>() { + @Override + public T call(Client client) throws BlurException, TException { + // your code here... + } +});</code></pre> + +</p> <h3 id="simple_query_example">Query Example</h3> <p> This is a simple example of how to run a query via the Thrift API and get back search results. By default http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/da43794f/docs/using-blur.html ---------------------------------------------------------------------- diff --git a/docs/using-blur.html b/docs/using-blur.html index 738470b..91d6aa5 100644 --- a/docs/using-blur.html +++ b/docs/using-blur.html @@ -127,9 +127,60 @@ The following examples are of using the Thrift API directly. You will need to f <li>log4j-1.2.15.jar</li> </ul> + + <div class="bs-callout bs-callout-info"><h4>Note</h4>Other versions of these libraries could work, but these are the versions that Blur currently uses.</div> </p> + +<h3 id="simple_connection_example">Getting A Client Example</h3> +<p> +<h4>Connection String</h4> +The connection string can be parsed or constructed through "Connection" object. If you are using the +parsed version there are some options. At a minimum you will have to provide hostname and port: +<pre><code class="bash">host1:40010</code></pre> + +You can list multiple hosts: +<pre><code class="bash">host1:40010,host2:40010</code></pre> + +You can add a SOCKS proxy server for each host: +<pre><code class="bash">host1:40010/proxyhost1:6001</code></pre> + +You can also add a timeout on the socket of 90 seconds (the default is 60 seconds): +<pre><code class="bash">host1:40010/proxyhost1:6001#90000</code></pre> + +Multiple hosts with a different timeout: +<pre><code class="bash">host1:40010,host2:40010,host3:40010#90000</code></pre> + +Here is all options together: +<pre><code class="bash">host1:40010/proxyhost1:6001,host2:40010/proxyhost1:6001#90000</code></pre> + +<h4>Thrift Client</h4> +Client Example 1: +<pre><code class="java">Iface client = BlurClient.getClient("controller1:40010,controller2:40010");</code></pre> + +Client Example 2: +<pre><code class="java">Connection connection = new Connection("controller1:40010"); +Iface client = BlurClient.getClient(connection);</code></pre> + +Client Example 3: +<pre><code class="java">BlurClientManager.execute("controller1:40010,controller2:40010", new BlurCommand<T>() { + @Override + public T call(Client client) throws BlurException, TException { + // your code here... + } +});</code></pre> + +Client Example 4: +<pre><code class="java">List<Connection> connections = BlurClientManager.getConnections("controller1:40010,controller2:40010"); +BlurClientManager.execute(connections, new BlurCommand<T>() { + @Override + public T call(Client client) throws BlurException, TException { + // your code here... + } +});</code></pre> + +</p> <h3 id="simple_query_example">Query Example</h3> <p> This is a simple example of how to run a query via the Thrift API and get back search results. By default
