mirror of https://github.com/reiseburo/whoas
Check for response variable before using in the whoas publish code
The response variable could be null on unsuccessful response from the HTTP post. References #21
This commit is contained in:
parent
0b9cba8731
commit
f50b83bd04
|
@ -528,11 +528,38 @@ SequentialHookRunner that has run loop around queue pop and publishes the hook r
|
|||
<p>The clients of whoas library can add "whoas" configuration to build queue and runner of their choice.
|
||||
See the example below</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>queue: configure type and queue specific parameters</p>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>type: full classname for the queue class defined in whoas (e.g. com.github.lookout.whoas.InMemoryQueue)</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>key: key of the list data type (currently applies to redis)</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>hostname: hostname of the distributed queue server (currently applies to redis)</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>port: port of the distributed queue server (currently applies to redis)</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<p>runnerType: full classname for the runner class defined in whoas</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>whoas:
|
||||
queue:
|
||||
type: "com.github.lookout.whoas.RedisQueue"
|
||||
key: "queue"
|
||||
hostname: "localhost"
|
||||
port: 6379
|
||||
runnerType: "com.github.lookout.whoas.SequentialHookRunner"</pre>
|
||||
|
@ -543,7 +570,7 @@ See the example below</p>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2015-03-18 16:27:04 PDT
|
||||
Last updated 2015-03-19 17:23:59 EDT
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>AbstractHookQueue (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>AbstractHookRunner (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>HookRequest (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>InMemoryQueue (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>Publisher (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>RedisQueue (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>SequentialHookRunner (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>WhoasConfiguration (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>WhoasFactory (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
@ -203,7 +203,7 @@ if (location.href.indexOf('is-external=true') == -1) {
|
|||
<a name="queueConfig"><!-- --></a>
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>@com.fasterxml.jackson.annotation.JsonProperty
|
||||
<h4>@com.fasterxml.jackson.annotation.JsonProperty(value = "queue")
|
||||
<a href='../../../../com/github/lookout/whoas/WhoasQueueConfig.html'>WhoasQueueConfig</a> <strong>queueConfig</strong></h4>
|
||||
<p> Queue configuration
|
||||
</p>
|
||||
|
@ -268,7 +268,7 @@ java.lang.String <strong>runnerType</strong></h4>
|
|||
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
|
||||
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>
|
||||
or if the instantiation fails for some other reason. <DL><DT><B>Parameters:</B></DT><DD><code>hookQueue</code> - queue to associate with allocated runner</DD></DL><DL><DT><B>Returns:</B></DT><DD></DD></DL></p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by groovydoc (2.4.0) on Wed Mar 18 16:27:43 PDT 2015 -->
|
||||
<!-- Generated by groovydoc (2.4.0) on Thu Mar 19 17:25:23 EDT 2015 -->
|
||||
<title>WhoasQueueConfig (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<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">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Generated by groovydoc (2.4.0) on -->
|
||||
<title>Deprecated API (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||
<link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
|
||||
<link href="groovy.ico" type="image/x-icon" rel="icon">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<title>API Help (whoas 0.1.4 API)</title>
|
||||
<link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
|
||||
<link href="groovy.ico" type="image/x-icon" rel="icon">
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||
</head>
|
||||
<body class="center">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Generated by groovydoc (2.4.0) on -->
|
||||
<title>Index (whoas 0.1.4 API)</title>
|
||||
<meta name="date" content="2015-03-18">
|
||||
<meta name="date" content="2015-03-19">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||
</head>
|
||||
<body class="center">
|
||||
|
|
|
@ -566,7 +566,7 @@ the <strong>server-side</strong> component, i.e. a "webhook publisher."</p>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2014-12-31 12:10:04 PST
|
||||
Last updated 2015-03-13 11:50:54 EDT
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -581,7 +581,7 @@ request</p>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2014-12-30 22:15:54 PST
|
||||
Last updated 2015-03-13 11:50:54 EDT
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -11,10 +11,18 @@ Library Configuration
|
|||
The clients of whoas library can add "whoas" configuration to build queue and runner of their choice.
|
||||
See the example below
|
||||
|
||||
* queue: configure type and queue specific parameters
|
||||
** type: full classname for the queue class defined in whoas (e.g. com.github.lookout.whoas.InMemoryQueue)
|
||||
** key: key of the list data type (currently applies to redis)
|
||||
** hostname: hostname of the distributed queue server (currently applies to redis)
|
||||
** port: port of the distributed queue server (currently applies to redis)
|
||||
* runnerType: full classname for the runner class defined in whoas
|
||||
|
||||
----
|
||||
whoas:
|
||||
queue:
|
||||
type: "com.github.lookout.whoas.RedisQueue"
|
||||
key: "queue"
|
||||
hostname: "localhost"
|
||||
port: 6379
|
||||
runnerType: "com.github.lookout.whoas.SequentialHookRunner"
|
||||
|
|
|
@ -30,7 +30,6 @@ abstract class AbstractHookQueue {
|
|||
*/
|
||||
abstract Long getSize()
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@ import javax.ws.rs.client.Invocation
|
|||
import javax.ws.rs.core.Response
|
||||
import javax.ws.rs.ProcessingException
|
||||
|
||||
|
||||
/**
|
||||
* Publisher is the class responsible for implementing the *actual* HTTP
|
||||
* request logic for Whoas
|
||||
|
@ -40,6 +41,7 @@ class Publisher {
|
|||
Invocation inv = buildInvocationFrom(request)
|
||||
try {
|
||||
response = inv.invoke()
|
||||
|
||||
/* LOG: response */
|
||||
String responseBody = response.readEntity(String.class)
|
||||
}
|
||||
|
@ -66,6 +68,10 @@ class Publisher {
|
|||
* Determine whether this response meets our criteria for retry
|
||||
*/
|
||||
Boolean shouldRetry(Response response) {
|
||||
if (response == null) {
|
||||
return true
|
||||
}
|
||||
|
||||
/* Enhance your calm and try again */
|
||||
if (response.status == 420) {
|
||||
return true
|
||||
|
|
|
@ -13,7 +13,7 @@ public class WhoasFactory {
|
|||
/**
|
||||
* Queue configuration
|
||||
*/
|
||||
@JsonProperty
|
||||
@JsonProperty(value = "queue")
|
||||
WhoasQueueConfig queueConfig = new WhoasQueueConfig()
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue