Merge pull request #20 from lookout/redis-rebase

Rebasing mahesh's work
This commit is contained in:
R. Tyler Croy 2015-03-18 16:47:30 -07:00
commit 0b9cba8731
26 changed files with 1292 additions and 285 deletions

View File

@ -35,7 +35,9 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.3+'
/* Needed for better time management/sanity */
compile 'joda-time:joda-time:2.6+'
/* redis client */
compile 'redis.clients:jedis:2.6+'
testCompile 'com.fiftyonred:mock-jedis:0.4.0'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'cglib:cglib-nodep:2.2.+'

View File

@ -531,7 +531,10 @@ See the example below</p>
<div class="listingblock">
<div class="content">
<pre>whoas:
queueType: "com.github.lookout.whoas.Queue"
queue:
type: "com.github.lookout.whoas.RedisQueue"
hostname: "localhost"
port: 6379
runnerType: "com.github.lookout.whoas.SequentialHookRunner"</pre>
</div>
</div>
@ -540,7 +543,7 @@ See the example below</p>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2015-03-18 08:48:36 PDT
Last updated 2015-03-18 16:27:04 PDT
</div>
</div>
</body>

View File

@ -17,9 +17,11 @@
<li><a href="com/github/lookout/whoas/HookRequest.html" title="class in com.github.lookout.whoas" target="classFrame">HookRequest</a></li>
<li><a href="com/github/lookout/whoas/InMemoryQueue.html" title="class in com.github.lookout.whoas" target="classFrame">InMemoryQueue</a></li>
<li><a href="com/github/lookout/whoas/Publisher.html" title="class in com.github.lookout.whoas" target="classFrame">Publisher</a></li>
<li><a href="com/github/lookout/whoas/RedisQueue.html" title="class in com.github.lookout.whoas" target="classFrame">RedisQueue</a></li>
<li><a href="com/github/lookout/whoas/SequentialHookRunner.html" title="class in com.github.lookout.whoas" target="classFrame">SequentialHookRunner</a></li>
<li><a href="com/github/lookout/whoas/WhoasConfiguration.html" title="interface in com.github.lookout.whoas" target="classFrame"><I>WhoasConfiguration</I></a></li>
<li><a href="com/github/lookout/whoas/WhoasFactory.html" title="class in com.github.lookout.whoas" target="classFrame">WhoasFactory</a></li>
<li><a href="com/github/lookout/whoas/WhoasQueueConfig.html" title="class in com.github.lookout.whoas" target="classFrame">WhoasQueueConfig</a></li>
</ul>
</div>

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>AbstractHookQueue (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -50,11 +50,11 @@ if (location.href.indexOf('is-external=true') == -1) {
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
Nested&nbsp;&nbsp;&nbsp;<li><a href="#field_summary">Field</a></li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
<li><a href="#field_detail">Field</a></li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
</div>
<a name="skip-navbar_top">
@ -98,6 +98,30 @@ if (location.href.indexOf('is-external=true') == -1) {
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary"><!-- --></a>
<h3>Field Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum constants summary table">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifiers</th>
<th class="colLast" scope="col">Name</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><strong>protected&nbsp;java.lang.Boolean</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#started">started</a></code></td>
<td class="colLast"></code></td>
</tr>
</table>
</ul>
</li>
</ul>
<!-- =========== PROPERTY SUMMARY =========== -->
@ -137,6 +161,16 @@ if (location.href.indexOf('is-external=true') == -1) {
<td class="colLast"><code><strong><a href="#push(com.github.lookout.whoas.HookRequest)">push</a></strong>(<a href='../../../../com/github/lookout/whoas/HookRequest.html'>HookRequest</a> request)</code><br></td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#start()">start</a></strong>()</code><br></td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#stop()">stop</a></strong>()</code><br></td>
</tr>
</table>
</ul>
</li>
@ -171,6 +205,24 @@ if (location.href.indexOf('is-external=true') == -1) {
<!-- =========== FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="started"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>protected&nbsp;java.lang.Boolean <strong>started</strong></h4>
<p></p>
</li>
</ul>
</li>
</ul>
@ -215,6 +267,22 @@ if (location.href.indexOf('is-external=true') == -1) {
</li>
</ul>
<a name="start()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>void <strong>start</strong>()</h4>
<p></p>
</li>
</ul>
<a name="stop()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>void <strong>stop</strong>()</h4>
<p></p>
</li>
</ul>
</li>
</ul>
@ -249,11 +317,11 @@ if (location.href.indexOf('is-external=true') == -1) {
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
Nested&nbsp;&nbsp;&nbsp;<li><a href="#field_summary">Field</a></li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
<li><a href="#field_detail">Field</a></li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
</div>
<p>Groovy Documentation</p>

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>AbstractHookRunner (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>HookRequest (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -50,11 +50,11 @@ if (location.href.indexOf('is-external=true') == -1) {
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
</div>
<a name="skip-navbar_top">
@ -135,45 +135,6 @@ if (location.href.indexOf('is-external=true') == -1) {
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary"><!-- --></a>
<h3>Methods Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Methods Summary table">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Type</th>
<th class="colLast" scope="col">Name and description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</strong></code></td>
<td class="colLast"><code><strong><a href="#getDeliverAfter()">getDeliverAfter</a></strong>()</code><br></td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</strong></code></td>
<td class="colLast"><code><strong><a href="#getPostData()">getPostData</a></strong>()</code><br></td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Long</strong></code></td>
<td class="colLast"><code><strong><a href="#getRetries()">getRetries</a></strong>()</code><br></td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</strong></code></td>
<td class="colLast"><code><strong><a href="#getUrl()">getUrl</a></strong>()</code><br></td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#setRetries(java.lang.Long)">setRetries</a></strong>(java.lang.Long newRetries)</code><br></td>
</tr>
</table>
</ul>
</li>
<li class="blockList"><a name="method_summary"><!-- --></a>
<h3>Inherited Methods Summary</h3>
<ul class="blockList">
@ -241,60 +202,6 @@ if (location.href.indexOf('is-external=true') == -1) {
<!-- =========== METHOD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getDeliverAfter()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>getDeliverAfter</strong>()</h4>
<p></p>
</li>
</ul>
<a name="getPostData()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>getPostData</strong>()</h4>
<p></p>
</li>
</ul>
<a name="getRetries()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.Long <strong>getRetries</strong>()</h4>
<p></p>
</li>
</ul>
<a name="getUrl()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>getUrl</strong>()</h4>
<p></p>
</li>
</ul>
<a name="setRetries(java.lang.Long)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>void <strong>setRetries</strong>(java.lang.Long newRetries)</h4>
<p></p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
@ -326,11 +233,11 @@ java.lang.String <strong>getUrl</strong>()</h4>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
</div>
<p>Groovy Documentation</p>

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>InMemoryQueue (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -96,6 +96,26 @@ if (location.href.indexOf('is-external=true') == -1) {
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary"><!-- --></a>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited fields summary table">
<caption><span>Inherited fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Fields inherited from class</th>
<th class="colLast" scope="col">Fields</th>
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html'>AbstractHookQueue</a></code></strong></td>
<td class="colLast"><code><a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#started'>started</a></code></td>
</tr>
</table>
</ul>
</li>
</ul>
<!-- =========== PROPERTY SUMMARY =========== -->
@ -117,11 +137,17 @@ if (location.href.indexOf('is-external=true') == -1) {
<tr class="altColor">
<td class="colFirst">
<code><a href="#InMemoryQueue()">InMemoryQueue</a></strong>
()</code><br>Create the InMemoryQueue with it's own internal queueing implementation</td>
<code><a href="#InMemoryQueue(com.github.lookout.whoas.WhoasQueueConfig)">InMemoryQueue</a></strong>
(<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> queueConfig)</code><br>Create the InMemoryQueue from configuration</td>
</tr>
<tr class="rowColor">
<td class="colFirst">
<code><a href="#InMemoryQueue()">InMemoryQueue</a></strong>
()</code><br>Default constructor</td>
</tr>
<tr class="altColor">
<td class="colFirst">
<code><a href="#InMemoryQueue(Queue<HookRequest>)">InMemoryQueue</a></strong>
(java.util.Queue&lt;<a href='../../../../com/github/lookout/whoas/HookRequest.html' title='HookRequest'>HookRequest</a>&gt; queue)</code><br>Create the InMemoryQueue with the given Queue object</td>
@ -179,7 +205,7 @@ if (location.href.indexOf('is-external=true') == -1) {
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html'>AbstractHookQueue</a></strong></code></td>
<td class="colLast"><code><a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#getSize()'>getSize</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#pop(groovy.lang.Closure)'>pop</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#push(com.github.lookout.whoas.HookRequest)'>push</a></code></td>
<td class="colLast"><code><a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#getSize()'>getSize</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#pop(groovy.lang.Closure)'>pop</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#push(com.github.lookout.whoas.HookRequest)'>push</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#start()'>start</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#stop()'>stop</a></code></td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class java.lang.Object</strong></code></td>
@ -214,11 +240,20 @@ if (location.href.indexOf('is-external=true') == -1) {
</a>
<h3>Constructor Detail</h3>
<a name="InMemoryQueue(com.github.lookout.whoas.WhoasQueueConfig)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4><strong>InMemoryQueue</strong>(<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> queueConfig)</h4>
<p> Create the InMemoryQueue from configuration
</p>
</li>
</ul>
<a name="InMemoryQueue()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4><strong>InMemoryQueue</strong>()</h4>
<p> Create the InMemoryQueue with it's own internal queueing implementation
<p> Default constructor
</p>
</li>
</ul>

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>Publisher (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

View File

@ -0,0 +1,396 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- **************************************************************** -->
<!-- * PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * -->
<!-- * i.e. only iterate & print data where possible. Thanks, Jez. * -->
<!-- **************************************************************** -->
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>RedisQueue (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../../../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../../../../groovy.ico" type="image/x-icon" rel="icon">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<body class="center">
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RedisQueue (whoas 0.1.4 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="navList">
<li><a href="../../../../index.html?com/github/lookout/whoas/RedisQueue" target="_top">Frames</a></li>
<li><a href="RedisQueue.html" target="_top">No Frames</a></li>
</ul>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">Package: <strong>com.github.lookout.whoas</strong></div>
<h2 title="[Groovy] Class RedisQueue" class="title">[Groovy] Class RedisQueue</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><ul class="inheritance"></ul></li><li><ul class="inheritance"></ul></li><li>com.github.lookout.whoas.RedisQueue
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<p> A redis queue that offers distributed and persistent queue
</p>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== NESTED CLASS SUMMARY =========== -->
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary"><!-- --></a>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited fields summary table">
<caption><span>Inherited fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Fields inherited from class</th>
<th class="colLast" scope="col">Fields</th>
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html'>AbstractHookQueue</a></code></strong></td>
<td class="colLast"><code><a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#started'>started</a></code></td>
</tr>
</table>
</ul>
</li>
</ul>
<!-- =========== PROPERTY SUMMARY =========== -->
<!-- =========== ELEMENT SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary"><!-- --></a>
<h3>Constructor Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructors Summary table">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor and description</th>
</tr>
<tr class="altColor">
<td class="colFirst">
<code><a href="#RedisQueue(com.github.lookout.whoas.WhoasQueueConfig)">RedisQueue</a></strong>
(<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> queueConfig)</code><br>Create the RedisQueue with valid config</td>
</tr>
<tr class="rowColor">
<td class="colFirst">
<code><a href="#RedisQueue()">RedisQueue</a></strong>
()</code><br>Default constructor</td>
</tr>
</table>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary"><!-- --></a>
<h3>Methods Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Methods Summary table">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Type</th>
<th class="colLast" scope="col">Name and description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Long</strong></code></td>
<td class="colLast"><code><strong><a href="#getSize()">getSize</a></strong>()</code><br>Return the number of elements in the queue</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#pop(groovy.lang.Closure)">pop</a></strong>(groovy.lang.Closure action)</code><br>Performs a blocking pop on the queue and invokes the closure with the
item popped from the queue</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Boolean</strong></code></td>
<td class="colLast"><code><strong><a href="#push(com.github.lookout.whoas.HookRequest)">push</a></strong>(<a href='../../../../com/github/lookout/whoas/HookRequest.html'>HookRequest</a> request)</code><br>The blpop returns list of strings (key and value)</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#start()">start</a></strong>()</code><br>Setup the Redis client</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#stop()">stop</a></strong>()</code><br>Setup jedis pool</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.Object</strong></code></td>
<td class="colLast"><code><strong><a href="#withRedis(groovy.lang.Closure)">withRedis</a></strong>(groovy.lang.Closure closure)</code><br></td>
</tr>
</table>
</ul>
</li>
<li class="blockList"><a name="method_summary"><!-- --></a>
<h3>Inherited Methods Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited Methods Summary table">
<caption><span>Inherited Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Methods inherited from class</th>
<th class="colLast" scope="col">Name</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html'>AbstractHookQueue</a></strong></code></td>
<td class="colLast"><code><a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#getSize()'>getSize</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#pop(groovy.lang.Closure)'>pop</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#push(com.github.lookout.whoas.HookRequest)'>push</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#start()'>start</a>, <a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html#stop()'>stop</a></code></td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class java.lang.Object</strong></code></td>
<td class="colLast"><code>java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()</code></td>
</tr>
</table>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- =========== CONSTRUCTOR DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="RedisQueue(com.github.lookout.whoas.WhoasQueueConfig)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4><strong>RedisQueue</strong>(<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> queueConfig)</h4>
<p> Create the RedisQueue with valid config
</p>
</li>
</ul>
<a name="RedisQueue()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4><strong>RedisQueue</strong>()</h4>
<p> Default constructor
</p>
</li>
</ul>
</li>
</ul>
<!-- =========== METHOD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getSize()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.Long <strong>getSize</strong>()</h4>
<p> Return the number of elements in the queue
</p>
</li>
</ul>
<a name="pop(groovy.lang.Closure)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>void <strong>pop</strong>(groovy.lang.Closure action)</h4>
<p> Performs a blocking pop on the queue and invokes the closure with the
item popped from the queue
If the Closure throws an exception, the dequeued item will be returned
to the tail end of the queue
</p>
</li>
</ul>
<a name="push(com.github.lookout.whoas.HookRequest)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.Boolean <strong>push</strong>(<a href='../../../../com/github/lookout/whoas/HookRequest.html'>HookRequest</a> request)</h4>
<p> The blpop returns list of strings (key and value)
</p>
</li>
</ul>
<a name="start()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@java.lang.Override
void <strong>start</strong>()</h4>
<p> Setup the Redis client
</p>
</li>
</ul>
<a name="stop()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@java.lang.Override
void <strong>stop</strong>()</h4>
<p> Setup jedis pool
A single jedis instance is NOT thread-safe. JedisPool maintains a thread-safe
pool of network connections. The pool will allow us to maintain a pool of
multiple jedis instances and use them reliably and efficiently across different
threads
</p>
</li>
</ul>
<a name="withRedis(groovy.lang.Closure)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.Object <strong>withRedis</strong>(groovy.lang.Closure closure)</h4>
<p></p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="navList">
<li><a href="../../../../index.html?com/github/lookout/whoas/RedisQueue" target="_top">Frames</a></li>
<li><a href="RedisQueue.html" target="_top">No Frames</a></li>
</ul>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
</ul>
</div>
<p>Groovy Documentation</p>
<a name="skip-navbar_bottom">
<!-- -->
</a>
</div>
</div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>SequentialHookRunner (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>WhoasConfiguration (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

View File

@ -6,7 +6,7 @@
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 10:01:26 PDT 2015 -->
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>WhoasFactory (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -113,8 +113,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</tr>
<tr class="altColor">
<td class="colFirst"><code><strong>java.lang.String</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#queueType"></a>queueType</code><br>Type of queue to create in whoas</td>
<td class="colFirst"><code><strong><a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a></strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#queueConfig"></a>queueConfig</code><br>Queue configuration</td>
</tr>
<tr class="rowColor">
@ -157,26 +157,6 @@ if (location.href.indexOf('is-external=true') == -1) {
<td class="colLast"><code><strong><a href="#buildRunner(com.github.lookout.whoas.AbstractHookQueue)">buildRunner</a></strong>(<a href='../../../../com/github/lookout/whoas/AbstractHookQueue.html'>AbstractHookQueue</a> hookQueue)</code><br>Allocate and return runner based on stored runner type</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</strong></code></td>
<td class="colLast"><code><strong><a href="#getQueueType()">getQueueType</a></strong>()</code><br>Get function for queue type in the factory</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</strong></code></td>
<td class="colLast"><code><strong><a href="#getRunnerType()">getRunnerType</a></strong>()</code><br>Get function for runner type in the factory</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</strong></code></td>
<td class="colLast"><code><strong><a href="#setQueueType(java.lang.String)">setQueueType</a></strong>(java.lang.String queueType)</code><br>Set function for the queue type in the factory</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.Object</strong></code></td>
<td class="colLast"><code><strong><a href="#setRunnerType(java.lang.String)">setRunnerType</a></strong>(java.lang.String runnerType)</code><br>Set function for runner type in the factory</td>
</tr>
</table>
</ul>
</li>
@ -220,14 +200,12 @@ if (location.href.indexOf('is-external=true') == -1) {
</a>
<h3>Property Detail</h3>
<a name="queueType"><!-- --></a>
<a name="queueConfig"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>queueType</strong></h4>
<p> Type of queue to create in whoas
Default queue in whoas is InMemoryQueue
<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> <strong>queueConfig</strong></h4>
<p> Queue configuration
</p>
</li>
</ul>
@ -271,8 +249,8 @@ java.lang.String <strong>runnerType</strong></h4>
ClassNotFoundException - if the class is not found
IllegalAccessException - if the class or its nullary constructor is not accessible.
InstantiationException - if this Class represents an abstract class, an interface,
an array class, a primitive type, or void;
or if the class has no nullary constructor;
an array class, a primitive type, or void
or if the class has no nullary constructor
or if the instantiation fails for some other reason.
<DL><DT><B>Returns:</B></DT><DD>allocated queue</DD></DL></p>
</li>
@ -288,47 +266,12 @@ java.lang.String <strong>runnerType</strong></h4>
ClassNotFoundException - if the class is not found
IllegalAccessException - if the class or its nullary constructor is not accessible.
InstantiationException - if this Class represents an abstract class, an interface,
an array class, a primitive type, or void;
or if the class has no nullary constructor;
an array class, a primitive type, or void
or if the class has no nullary constructor
or if the instantiation fails for some other reason. <DL><DT><B>Returns:</B></DT><DD></DD></DL><DL><DT><B>Parameters:</B></DT><DD><code>hookQueue</code> - queue to associate with allocated runner</DD></DL></p>
</li>
</ul>
<a name="getQueueType()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.String <strong>getQueueType</strong>()</h4>
<p> Get function for queue type in the factory
<DL><DT><B>Returns:</B></DT><DD>queue type in the factory</DD></DL></p>
</li>
</ul>
<a name="getRunnerType()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.String <strong>getRunnerType</strong>()</h4>
<p> Get function for runner type in the factory
<DL><DT><B>Returns:</B></DT><DD>runner type in the factory</DD></DL></p>
</li>
</ul>
<a name="setQueueType(java.lang.String)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>void <strong>setQueueType</strong>(java.lang.String queueType)</h4>
<p> Set function for the queue type in the factory
<DL><DT><B>Parameters:</B></DT><DD><code>queueType</code> - type of queue to store</DD></DL></p>
</li>
</ul>
<a name="setRunnerType(java.lang.String)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>java.lang.Object <strong>setRunnerType</strong>(java.lang.String runnerType)</h4>
<p> Set function for runner type in the factory <DL><DT><B>Returns:</B></DT><DD></DD></DL><DL><DT><B>Parameters:</B></DT><DD><code>runnerType</code> - type of the runner to store</DD></DL></p>
</li>
</ul>
</li>
</ul>

View File

@ -0,0 +1,291 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- **************************************************************** -->
<!-- * PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * -->
<!-- * i.e. only iterate & print data where possible. Thanks, Jez. * -->
<!-- **************************************************************** -->
<html>
<head>
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
<title>WhoasQueueConfig (whoas 0.1.4 API)</title>
<meta name="date" content="2015-03-18">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../../../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../../../../groovy.ico" type="image/x-icon" rel="icon">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<body class="center">
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="WhoasQueueConfig (whoas 0.1.4 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="navList">
<li><a href="../../../../index.html?com/github/lookout/whoas/WhoasQueueConfig" target="_top">Frames</a></li>
<li><a href="WhoasQueueConfig.html" target="_top">No Frames</a></li>
</ul>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;<li><a href="#property_summary">Property</a></li>&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;<li><a href="#prop_detail">Property</a></li>&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">Package: <strong>com.github.lookout.whoas</strong></div>
<h2 title="[Groovy] Class WhoasQueueConfig" class="title">[Groovy] Class WhoasQueueConfig</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><ul class="inheritance"></ul></li><li>com.github.lookout.whoas.WhoasQueueConfig
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<p> Whoas Queue Configuration
</p>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== NESTED CLASS SUMMARY =========== -->
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- =========== PROPERTY SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="property_summary"><!-- --></a>
<h3>Properties Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties Summary table, listing nested classes, and an explanation">
<caption><span>Properties</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Type</th>
<th class="colLast" scope="col">Name and description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><strong>java.lang.String</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#hostname"></a>hostname</code><br>Hostname of the distributed queue server</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><strong>java.lang.String</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#key"></a>key</code><br>key to idenitfy the distributed queue</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><strong>java.lang.Integer</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#port"></a>port</code><br>Port number of the distributed queue server</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><strong>java.lang.String</strong></code>&nbsp;</td>
<td class="colLast"><code><a href="#type"></a>type</code><br>Type of queue (full class name) to create in whoas</td>
</tr>
</table>
</ul>
</li>
</ul>
<!-- =========== ELEMENT SUMMARY =========== -->
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary"><!-- --></a>
<h3>Inherited Methods Summary</h3>
<ul class="blockList">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited Methods Summary table">
<caption><span>Inherited Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Methods inherited from class</th>
<th class="colLast" scope="col">Name</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class java.lang.Object</strong></code></td>
<td class="colLast"><code>java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()</code></td>
</tr>
</table>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- =========== PROPERTY DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="prop_detail">
<!-- -->
</a>
<h3>Property Detail</h3>
<a name="hostname"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>hostname</strong></h4>
<p> Hostname of the distributed queue server
Default hostname is localhost
</p>
</li>
</ul>
<a name="key"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>key</strong></h4>
<p> key to idenitfy the distributed queue
Default key is "queue"
</p>
</li>
</ul>
<a name="port"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.Integer <strong>port</strong></h4>
<p> Port number of the distributed queue server
Default port is 6379 (i.e. redis)
</p>
</li>
</ul>
<a name="type"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
<h4>@com.fasterxml.jackson.annotation.JsonProperty
java.lang.String <strong>type</strong></h4>
<p> Type of queue (full class name) to create in whoas
Default queue in whoas is InMemoryQueue
</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="navList">
<li><a href="../../../../index.html?com/github/lookout/whoas/WhoasQueueConfig" target="_top">Frames</a></li>
<li><a href="WhoasQueueConfig.html" target="_top">No Frames</a></li>
</ul>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;<li><a href="#property_summary">Property</a></li>&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
<ul class="subNavList">
<li>&nbsp;|&nbsp;Detail:&nbsp;</li>
Field&nbsp;&nbsp;&nbsp;<li><a href="#prop_detail">Property</a></li>&nbsp;&nbsp;&nbsp;Constructor&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;
</ul>
</div>
<p>Groovy Documentation</p>
<a name="skip-navbar_bottom">
<!-- -->
</a>
</div>
</div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>

View File

@ -31,7 +31,7 @@
<div class="indexContainer">
<h2>Classes</h2>
<ul>
<li><a href="AbstractHookQueue.html" title="class in com.github.lookout.whoas" target="classFrame">AbstractHookQueue</a></li><li><a href="AbstractHookRunner.html" title="class in com.github.lookout.whoas" target="classFrame">AbstractHookRunner</a></li><li><a href="HookRequest.html" title="class in com.github.lookout.whoas" target="classFrame">HookRequest</a></li><li><a href="InMemoryQueue.html" title="class in com.github.lookout.whoas" target="classFrame">InMemoryQueue</a></li><li><a href="Publisher.html" title="class in com.github.lookout.whoas" target="classFrame">Publisher</a></li><li><a href="SequentialHookRunner.html" title="class in com.github.lookout.whoas" target="classFrame">SequentialHookRunner</a></li><li><a href="WhoasFactory.html" title="class in com.github.lookout.whoas" target="classFrame">WhoasFactory</a></li>
<li><a href="AbstractHookQueue.html" title="class in com.github.lookout.whoas" target="classFrame">AbstractHookQueue</a></li><li><a href="AbstractHookRunner.html" title="class in com.github.lookout.whoas" target="classFrame">AbstractHookRunner</a></li><li><a href="HookRequest.html" title="class in com.github.lookout.whoas" target="classFrame">HookRequest</a></li><li><a href="InMemoryQueue.html" title="class in com.github.lookout.whoas" target="classFrame">InMemoryQueue</a></li><li><a href="Publisher.html" title="class in com.github.lookout.whoas" target="classFrame">Publisher</a></li><li><a href="RedisQueue.html" title="class in com.github.lookout.whoas" target="classFrame">RedisQueue</a></li><li><a href="SequentialHookRunner.html" title="class in com.github.lookout.whoas" target="classFrame">SequentialHookRunner</a></li><li><a href="WhoasFactory.html" title="class in com.github.lookout.whoas" target="classFrame">WhoasFactory</a></li><li><a href="WhoasQueueConfig.html" title="class in com.github.lookout.whoas" target="classFrame">WhoasQueueConfig</a></li>
</ul>
</div>

View File

@ -138,6 +138,14 @@ function windowTitle()
<td>Publisher is the class responsible for implementing the *actual* HTTP
request logic for Whoas</td>
</tr>
<tr class="altColor">
<td class="colOne">
<strong><a href="RedisQueue.html" title="class in com/github/lookout/whoas">
RedisQueue
</a></strong>
</td>
<td>A redis queue that offers distributed and persistent queue</td>
</tr>
<tr class="altColor">
<td class="colOne">
<strong><a href="SequentialHookRunner.html" title="class in com/github/lookout/whoas">
@ -157,6 +165,14 @@ function windowTitle()
different queues like in memory, persistent etc and runners
like sequential.</td>
</tr>
<tr class="altColor">
<td class="colOne">
<strong><a href="WhoasQueueConfig.html" title="class in com/github/lookout/whoas">
WhoasQueueConfig
</a></strong>
</td>
<td>Whoas Queue Configuration</td>
</tr>
</tbody>
</table>

View File

@ -160,25 +160,15 @@ if (location.href.indexOf('is-external=true') == -1) {
<h2 class="title">G</h2>
<dl>
<dt><span class="strong"><a href="com/github/lookout/whoas/HookRequest.html#getDeliverAfter()" title="Method in HookRequest">getDeliverAfter()</a></span> - Method in <a href="com/github/lookout/whoas/HookRequest.html">HookRequest</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/HookRequest.html#getPostData()" title="Method in HookRequest">getPostData()</a></span> - Method in <a href="com/github/lookout/whoas/HookRequest.html">HookRequest</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookRunner.html#getPublisher()" title="Method in AbstractHookRunner">getPublisher()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookRunner.html">AbstractHookRunner</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasFactory.html#getQueueType()" title="Method in WhoasFactory">getQueueType()</a></span> - Method in <a href="com/github/lookout/whoas/WhoasFactory.html">WhoasFactory</a>
</dt><dd> <div class="block">Get function for queue type in the factory</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/HookRequest.html#getRetries()" title="Method in HookRequest">getRetries()</a></span> - Method in <a href="com/github/lookout/whoas/HookRequest.html">HookRequest</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasFactory.html#getRunnerType()" title="Method in WhoasFactory">getRunnerType()</a></span> - Method in <a href="com/github/lookout/whoas/WhoasFactory.html">WhoasFactory</a>
</dt><dd> <div class="block">Get function for runner type in the factory</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookQueue.html#getSize()" title="Method in AbstractHookQueue">getSize()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookQueue.html">AbstractHookQueue</a>
</dt><dd> <div class="block">Return the size of the queue, may not be implemented by some providers
in which case it will return -1</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/InMemoryQueue.html#getSize()" title="Method in InMemoryQueue">getSize()</a></span> - Method in <a href="com/github/lookout/whoas/InMemoryQueue.html">InMemoryQueue</a>
</dt><dd> <div class="block">Return the number of elements in the queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/HookRequest.html#getUrl()" title="Method in HookRequest">getUrl()</a></span> - Method in <a href="com/github/lookout/whoas/HookRequest.html">HookRequest</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#getSize()" title="Method in RedisQueue">getSize()</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">Return the number of elements in the queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasConfiguration.html#getWhoasFactory(T)" title="Method in WhoasConfiguration">getWhoasFactory(T)</a></span> - Method in <a href="com/github/lookout/whoas/WhoasConfiguration.html">WhoasConfiguration</a>
</dt><dd> <div class="block"></div></dd>
</dl>
@ -258,6 +248,9 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookQueue.html#pop(groovy.lang.Closure)" title="Method in AbstractHookQueue">pop(Closure)</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookQueue.html">AbstractHookQueue</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/InMemoryQueue.html#pop(groovy.lang.Closure)" title="Method in InMemoryQueue">pop(Closure)</a></span> - Method in <a href="com/github/lookout/whoas/InMemoryQueue.html">InMemoryQueue</a>
</dt><dd> <div class="block">Performs a blocking pop on the queue and invokes the closure with the
item popped from the queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#pop(groovy.lang.Closure)" title="Method in RedisQueue">pop(Closure)</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">Performs a blocking pop on the queue and invokes the closure with the
item popped from the queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/Publisher.html#publish(com.github.lookout.whoas.HookRequest)" title="Method in Publisher">publish(HookRequest)</a></span> - Method in <a href="com/github/lookout/whoas/Publisher.html">Publisher</a>
@ -274,6 +267,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/InMemoryQueue.html#push(com.github.lookout.whoas.HookRequest)" title="Method in InMemoryQueue">push(HookRequest)</a></span> - Method in <a href="com/github/lookout/whoas/InMemoryQueue.html">InMemoryQueue</a>
</dt><dd> <div class="block">Attempt to insert the request into the queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#push(com.github.lookout.whoas.HookRequest)" title="Method in RedisQueue">push(HookRequest)</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">The blpop returns list of strings (key and value)</div></dd>
</dl>
@ -290,6 +285,10 @@ if (location.href.indexOf('is-external=true') == -1) {
<h2 class="title">R</h2>
<dl>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html" title="Class in com.github.lookout.whoas">RedisQueue</a></span> - Class in <a href="./com/github/lookout/whoas/package-summary.html">com.github.lookout.whoas</a>
</dt><dd><div class="block">A redis queue that offers distributed and persistent queue</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#RedisQueue()" title="Constructor in RedisQueue">RedisQueue()</a></span> - Constructor in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">Default constructor</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookRunner.html#run()" title="Method in AbstractHookRunner">run()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookRunner.html">AbstractHookRunner</a>
</dt><dd> <div class="block">Block forever and run the runner's runloop.</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/SequentialHookRunner.html#run()" title="Method in SequentialHookRunner">run()</a></span> - Method in <a href="com/github/lookout/whoas/SequentialHookRunner.html">SequentialHookRunner</a>
@ -304,16 +303,20 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="com/github/lookout/whoas/SequentialHookRunner.html" title="Class in com.github.lookout.whoas">SequentialHookRunner</a></span> - Class in <a href="./com/github/lookout/whoas/package-summary.html">com.github.lookout.whoas</a>
</dt><dd><div class="block">The SequentialHookRunner is will dequeue HookRequest items from the
configured AbstractHookQueue and publish those webhooks sequentially.</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasFactory.html#setQueueType(java.lang.String)" title="Method in WhoasFactory">setQueueType(String)</a></span> - Method in <a href="com/github/lookout/whoas/WhoasFactory.html">WhoasFactory</a>
</dt><dd> <div class="block">Set function for the queue type in the factory</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/HookRequest.html#setRetries(java.lang.Long)" title="Method in HookRequest">setRetries(Long)</a></span> - Method in <a href="com/github/lookout/whoas/HookRequest.html">HookRequest</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasFactory.html#setRunnerType(java.lang.String)" title="Method in WhoasFactory">setRunnerType(String)</a></span> - Method in <a href="com/github/lookout/whoas/WhoasFactory.html">WhoasFactory</a>
</dt><dd> <div class="block">Set function for runner type in the factory</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/Publisher.html#shouldRetry(javax.ws.rs.core.Response)" title="Method in Publisher">shouldRetry(Response)</a></span> - Method in <a href="com/github/lookout/whoas/Publisher.html">Publisher</a>
</dt><dd> <div class="block">Determine whether this response meets our criteria for retry</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookQueue.html#start()" title="Method in AbstractHookQueue">start()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookQueue.html">AbstractHookQueue</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#start()" title="Method in RedisQueue">start()</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">Setup the Redis client</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookQueue.html#started" title="Field in AbstractHookQueue">started</a></span> - Field in <a href="com/github/lookout/whoas/AbstractHookQueue.html">AbstractHookQueue</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookQueue.html#stop()" title="Method in AbstractHookQueue">stop()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookQueue.html">AbstractHookQueue</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/AbstractHookRunner.html#stop()" title="Method in AbstractHookRunner">stop()</a></span> - Method in <a href="com/github/lookout/whoas/AbstractHookRunner.html">AbstractHookRunner</a>
</dt><dd> <div class="block">Tell the runloop to stop</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#stop()" title="Method in RedisQueue">stop()</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block">Setup jedis pool</div></dd>
</dl>
@ -349,6 +352,10 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd><div class="block">This factory will allow clients of whoas to build
different queues like in memory, persistent etc and runners
like sequential.</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/WhoasQueueConfig.html" title="Class in com.github.lookout.whoas">WhoasQueueConfig</a></span> - Class in <a href="./com/github/lookout/whoas/package-summary.html">com.github.lookout.whoas</a>
</dt><dd><div class="block">Whoas Queue Configuration</div></dd>
<dt><span class="strong"><a href="com/github/lookout/whoas/RedisQueue.html#withRedis(groovy.lang.Closure)" title="Method in RedisQueue">withRedis(Closure)</a></span> - Method in <a href="com/github/lookout/whoas/RedisQueue.html">RedisQueue</a>
</dt><dd> <div class="block"></div></dd>
</dl>

View File

@ -13,7 +13,10 @@ See the example below
----
whoas:
queueType: "com.github.lookout.whoas.Queue"
queue:
type: "com.github.lookout.whoas.RedisQueue"
hostname: "localhost"
port: 6379
runnerType: "com.github.lookout.whoas.SequentialHookRunner"
----

View File

@ -7,6 +7,23 @@ package com.github.lookout.whoas
* This allows for different queueing implementations behind whoas
*/
abstract class AbstractHookQueue {
protected Boolean started = false
void start() {
if (started) {
throw new IllegalStateException()
}
started = true
}
void stop() {
if (!started) {
throw new IllegalStateException()
return
}
started = false
}
/**
* Return the size of the queue, may not be implemented by some providers
* in which case it will return -1

View File

@ -3,12 +3,20 @@ package com.github.lookout.whoas
import com.fasterxml.jackson.annotation.JsonProperty
import org.joda.time.DateTime
class HookRequest {
private Long retries
private String url
private String postData
private DateTime deliverAfter
class HookRequest {
@JsonProperty
private Long retries
@JsonProperty
private String url
@JsonProperty
private String postData
@JsonProperty
private DateTime deliverAfter
/** Constructor for Jackson */
HookRequest() { }
@ -22,28 +30,4 @@ class HookRequest {
this.url = hookUrl
this.postData = hookData
}
@JsonProperty
Long getRetries() {
return this.retries
}
void setRetries(Long newRetries) {
this.retries = newRetries
}
@JsonProperty
String getUrl() {
return this.url
}
@JsonProperty
String getPostData() {
return this.postData
}
@JsonProperty
String getDeliverAfter() {
return this.deliverAfter.toString()
}
}

View File

@ -10,7 +10,14 @@ class InMemoryQueue extends AbstractHookQueue {
private Queue<HookRequest> internalQueue
/**
* Create the InMemoryQueue with it's own internal queueing implementation
* Create the InMemoryQueue from configuration
*/
InMemoryQueue(WhoasQueueConfig queueConfig) {
this.internalQueue = new LinkedBlockingQueue<HookRequest>()
}
/**
* Default constructor
*/
InMemoryQueue() {
this.internalQueue = new LinkedBlockingQueue<HookRequest>()

View File

@ -0,0 +1,147 @@
package com.github.lookout.whoas
import com.fasterxml.jackson.databind.ObjectMapper
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisPool
import redis.clients.jedis.JedisPoolConfig
/**
* A redis queue that offers distributed and persistent queue
*/
class RedisQueue extends AbstractHookQueue {
private WhoasQueueConfig queueConfig
private JedisPool pool = null
private static Integer maxActiveConnections = 10
private static Integer maxIdleConnections = 5
private static Integer minIdleConnections = 1
/**
* Create the RedisQueue with valid config
*/
RedisQueue(WhoasQueueConfig queueConfig) {
this.queueConfig = queueConfig
}
/**
* Default constructor
*/
RedisQueue() {
queueConfig = new WhoasQueueConfig()
}
/**
* Return the number of elements in the queue
*/
Long getSize() {
if (!this.started) {
throw new Exception("Queue must be started before this operation is invoked")
}
return withRedis() { Jedis redisClient ->
return redisClient.llen(this.queueConfig.key)
}
}
/**
* Setup the Redis client
*/
@Override
void start() {
super.start()
/**
* Setup jedis pool
*
* A single jedis instance is NOT thread-safe. JedisPool maintains a thread-safe
* pool of network connections. The pool will allow us to maintain a pool of
* multiple jedis instances and use them reliably and efficiently across different
* threads
*/
JedisPoolConfig poolConfig = new JedisPoolConfig()
poolConfig.setMaxTotal(maxActiveConnections)
poolConfig.setTestOnBorrow(true)
poolConfig.setTestOnReturn(true)
poolConfig.setMaxIdle(maxIdleConnections)
poolConfig.setMinIdle(minIdleConnections)
poolConfig.setTestWhileIdle(true)
/* Create the pool */
pool = new JedisPool(poolConfig, this.queueConfig.hostname, this.queueConfig.port)
}
/**
* Stop the Redis client
*/
@Override
void stop() {
super.stop()
pool.destroy()
pool = null
}
Object withRedis(Closure closure) {
Jedis redisClient = pool.resource
try {
return closure.call(redisClient)
}
finally {
redisClient.close()
}
}
/**
* Performs a blocking pop on the queue and invokes the closure with the
* item popped from the queue
*
* If the Closure throws an exception, the dequeued item will be returned
* to the tail end of the queue
*/
void pop(Closure action) {
if (action == null) {
throw new Exception("Must provide a Closure to RedisQueue.pop()")
}
if (!this.started) {
throw new Exception("Queue must be started before this operation is invoked")
}
withRedis() { Jedis redisClient ->
/**
* The blpop returns list of strings (key and value)
*/
List<String> messages = redisClient.blpop(0, this.queueConfig.key)
/* If valid, decode message */
if (messages) {
ObjectMapper mapper = new ObjectMapper()
HookRequest request = mapper.readValue(messages.get(1), HookRequest.class)
try {
action.call(request)
} catch (Exception ex) {
/* Put this back on the front of the queue */
redisClient.lpush(this.queueConfig.key, messages.get(1))
throw ex
}
}
}
}
/**
* Attempt to insert the request into the queue
*
* If the request cannot be inserted, this method will return false,
* otherwise true.
*/
Boolean push(HookRequest request) {
if (!this.started) {
throw new Exception("Queue must be started before this operation is invoked")
}
ObjectMapper mapper = new ObjectMapper()
String jsonPayload = mapper.writeValueAsString(request)
return withRedis() { Jedis redisClient ->
return redisClient.rpush(this.queueConfig.key, jsonPayload) != 0
}
}
}

View File

@ -9,5 +9,5 @@ import io.dropwizard.Configuration
* @param < T > Configuration class that extends dropwizard configuration
*/
public interface WhoasConfiguration<T extends Configuration> {
WhoasFactory getWhoasFactory(T configuration);
WhoasFactory getWhoasFactory(T configuration)
}

View File

@ -1,7 +1,7 @@
package com.github.lookout.whoas
import com.fasterxml.jackson.annotation.JsonProperty
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.NotEmpty
/**
* This factory will allow clients of whoas to build
@ -11,30 +11,10 @@ import org.hibernate.validator.constraints.NotEmpty;
public class WhoasFactory {
/**
* Type of queue to create in whoas
*
* Default queue in whoas is InMemoryQueue
* Queue configuration
*/
@JsonProperty
String queueType = "com.github.lookout.whoas.InMemoryQueue"
/**
* Get function for queue type in the factory
*
* @return queue type in the factory
*/
public String getQueueType() {
return queueType
}
/**
* Set function for the queue type in the factory
*
* @param queueType type of queue to store
*/
public void setQueueType(String queueType) {
this.queueType = queueType
}
WhoasQueueConfig queueConfig = new WhoasQueueConfig()
/**
* Type of runner to create in whoas.
@ -44,25 +24,6 @@ public class WhoasFactory {
@JsonProperty
String runnerType = "com.github.lookout.whoas.SequentialHookRunner"
/**
* Get function for runner type in the factory
*
* @return runner type in the factory
*/
public String getRunnerType() {
return runnerType
}
/**
* Set function for runner type in the factory
*
* @param runnerType type of the runner to store
* @return
*/
public setRunnerType(String runnerType) {
this.runnerType = runnerType
}
/**
* Allocate and return the queue based on stored queue type.
*
@ -70,13 +31,14 @@ public class WhoasFactory {
* ClassNotFoundException - if the class is not found
* IllegalAccessException - if the class or its nullary constructor is not accessible.
* InstantiationException - if this Class represents an abstract class, an interface,
* an array class, a primitive type, or void;
* or if the class has no nullary constructor;
* an array class, a primitive type, or void
* or if the class has no nullary constructor
* or if the instantiation fails for some other reason.
* @return allocated queue
*/
public AbstractHookQueue buildQueue() {
return Class.forName(this.queueType).newInstance()
return Class.forName(this.queueConfig.type).getConstructor(WhoasQueueConfig.class).
newInstance(queueConfig)
}
/**
@ -86,8 +48,8 @@ public class WhoasFactory {
* ClassNotFoundException - if the class is not found
* IllegalAccessException - if the class or its nullary constructor is not accessible.
* InstantiationException - if this Class represents an abstract class, an interface,
* an array class, a primitive type, or void;
* or if the class has no nullary constructor;
* an array class, a primitive type, or void
* or if the class has no nullary constructor
* or if the instantiation fails for some other reason.
* @param hookQueue queue to associate with allocated runner
* @return

View File

@ -0,0 +1,42 @@
package com.github.lookout.whoas
import com.fasterxml.jackson.annotation.JsonProperty
/**
* Whoas Queue Configuration
*/
public class WhoasQueueConfig {
/**
* Type of queue (full class name) to create in whoas
*
* Default queue in whoas is InMemoryQueue
*/
@JsonProperty
String type = "com.github.lookout.whoas.InMemoryQueue"
/**
* key to idenitfy the distributed queue
*
* Default key is "queue"
*/
@JsonProperty
String key = "queue"
/**
* Hostname of the distributed queue server
*
* Default hostname is localhost
*/
@JsonProperty
String hostname = "localhost"
/**
* Port number of the distributed queue server
*
* Default port is 6379 (i.e. redis)
*/
@JsonProperty
Integer port = 6379
}

View File

@ -0,0 +1,150 @@
package com.github.lookout.whoas
import com.fiftyonred.mock_jedis.MockJedis
import redis.clients.jedis.Jedis
import spock.lang.*
class RedisQueueSpec extends Specification {
def "getSize()ing without a start should throw"() {
given:
RedisQueue q = new RedisQueue()
when:
q.getSize()
then:
thrown Exception
}
def "getSize() should return 0 by default"() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
then:
queue.getSize() == 0
}
def "pop()ing without a closure should throw"() {
given:
RedisQueue q = new RedisQueue()
when:
q.pop()
then:
thrown Exception
}
def "pop()ing without a start should throw"() {
given:
RedisQueue q = new RedisQueue()
when:
q.pop()
then:
thrown Exception
}
def "push()ing without a start should throw"() {
given:
RedisQueue q = new RedisQueue()
when:
queue.push(new HookRequest())
then:
thrown Exception
}
def "push() should put onto the internal queue"() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
redisClient.metaClass.rpush = {String key, String payload -> redisClient.lpush(key, payload)}
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
queue.push(new HookRequest())
queue.push(new HookRequest())
then:
queue.getSize() == 2
}
def "pop() after push should receive a request"() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
redisClient.metaClass.rpush = {String key, String payload -> redisClient.lpush(key, payload)}
redisClient.metaClass.blpop = {Integer timeout, String key -> [key, redisClient.lpop(key)]}
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
HookRequest test = new HookRequest()
queue.push(test)
then:
queue.getSize() == 1
queue.pop() { HookRequest fetched -> fetched == test}
queue.getSize() == 0
}
def "push() on rpush exception should return false"() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
redisClient.metaClass.rpush = {String key, String payload -> throw new Exception("Test Exception")}
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
queue.push(new HookRequest())
then:
thrown Exception
}
def "pop() on blpop exception simple return, nothing to requeue "() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
redisClient.metaClass.blpop = {Integer timeout, String key -> throw new Exception("Test Exception")}
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
queue.pop() { }
then:
thrown Exception
}
def "pop() on exception while executing closure should requeue"() {
given:
RedisQueue queue = new RedisQueue()
Jedis redisClient = new MockJedis("test")
redisClient.metaClass.rpush = {String key, String payload -> redisClient.lpush(key, payload)}
redisClient.metaClass.blpop = {Integer timeout, String key -> [key, redisClient.lpop(key)]}
when:
queue.start()
queue.pool.metaClass.getResource = {redisClient}
queue.push(new HookRequest())
queue.pop() { throw new Exception("Test Exception") }
then:
thrown Exception
queue.getSize() == 1
}
}

View File

@ -26,18 +26,17 @@ class WhoasFactorySpec extends Specification {
def "given a queue class name, buildQueue should create specified queue"() {
given:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.setQueueType("com.github.lookout.whoas.InMemoryQueue")
whoasFactory.queueConfig.type = "com.github.lookout.whoas.InMemoryQueue"
InMemoryQueue inMemoryQueue = whoasFactory.buildQueue()
expect:
inMemoryQueue instanceof InMemoryQueue
}
def "given a invalid class name, buildQueue should throw ClassNotFound exception"() {
when:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.setQueueType("com.github.lookout.InvalidQueue")
whoasFactory.queueConfig.type = "com.github.lookout.InvalidQueue"
AbstractHookQueue abstractHookQueue = whoasFactory.buildQueue()
then:
@ -47,7 +46,7 @@ class WhoasFactorySpec extends Specification {
def "given a runner class name, buildQueue should create specified queue"() {
given:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.setRunnerType("com.github.lookout.whoas.SequentialHookRunner")
whoasFactory.runnerType = "com.github.lookout.whoas.SequentialHookRunner"
SequentialHookRunner sequentialHookRunner = whoasFactory.buildRunner(whoasFactory.buildQueue())
expect:
@ -58,11 +57,37 @@ class WhoasFactorySpec extends Specification {
def "given a invalid class name, buildRunner should throw ClassNotFound exception"() {
when:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.setRunnerType("com.github.lookout.whoas.Invalidunner")
whoasFactory.runnerType = "com.github.lookout.whoas.Invalidunner"
AbstractHookRunner abstractHookRunner = whoasFactory.buildRunner(whoasFactory.buildQueue())
then:
thrown(ClassNotFoundException)
}
def "Create RedisQueue with default hostname and port config"() {
given:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.queueConfig.type = "com.github.lookout.whoas.RedisQueue"
RedisQueue redisQueue = whoasFactory.buildQueue()
expect:
redisQueue instanceof RedisQueue
redisQueue.queueConfig.hostname == "localhost"
redisQueue.queueConfig.port == 6379
redisQueue.queueConfig.key == "queue"
}
def "Create RedisQueue with non-default hostname and port config"() {
given:
WhoasFactory whoasFactory = new WhoasFactory()
whoasFactory.queueConfig.type = "com.github.lookout.whoas.RedisQueue"
whoasFactory.queueConfig.hostname = "redis.lookout.com"
whoasFactory.queueConfig.port = 1234
whoasFactory.queueConfig.key = "foo"
RedisQueue redisQueue = whoasFactory.buildQueue()
expect:
redisQueue instanceof RedisQueue
redisQueue.queueConfig == whoasFactory.queueConfig
}
}