embulk-output-mailchimp 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/build.gradle +3 -3
- data/src/main/java/org/embulk/output/mailchimp/MailChimpAbstractRecordBuffer.java +2 -7
- data/src/main/java/org/embulk/output/mailchimp/MailChimpHttpClient.java +36 -42
- data/src/main/java/org/embulk/output/mailchimp/MailChimpRecordBuffer.java +6 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7ffeeb484184fcbcb739aef1c871a0c915fca74
|
4
|
+
data.tar.gz: ab5372d39822ac2c231945f1360611ed83f555ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff9ea7f57503ac6149b87fb78a67200cfc59fde7fbf66e1bb632d660ab5480a5f4a9e50ddd8d94bdd9d6a4ec2a8b5dc9ee85f4f2c6b1c4f4041e915a991d6483
|
7
|
+
data.tar.gz: 15126516099f6bb739522ec13e9dfcda26ed365a0f686e5e7d9fe7c3dcb37d68cbe97e14a6a760acfa13cfa8c933b20e9f7dad36c5505846bda60817dcb0dde7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.3.13 - 2017-06-16
|
2
|
+
- Upgraded `embulk-base-restclient` to v0.5.3 and fixed hang job [#28](https://github.com/treasure-data/embulk-output-mailchimp/pull/28)
|
3
|
+
|
1
4
|
## 0.3.12 - 2017-06-13
|
2
5
|
- Fixed NPE while reading JSON data [#27](https://github.com/treasure-data/embulk-output-mailchimp/pull/27)
|
3
6
|
|
data/build.gradle
CHANGED
@@ -18,7 +18,7 @@ configurations {
|
|
18
18
|
provided
|
19
19
|
}
|
20
20
|
|
21
|
-
version = "0.3.
|
21
|
+
version = "0.3.13"
|
22
22
|
|
23
23
|
sourceCompatibility = 1.7
|
24
24
|
targetCompatibility = 1.7
|
@@ -26,8 +26,8 @@ targetCompatibility = 1.7
|
|
26
26
|
dependencies {
|
27
27
|
compile "org.embulk:embulk-core:0.8.15"
|
28
28
|
provided "org.embulk:embulk-core:0.8.15"
|
29
|
-
compile "org.embulk.base.restclient:embulk-base-restclient:0.5.
|
30
|
-
compile "org.embulk.base.restclient:embulk-util-retryhelper-jetty92:0.5.
|
29
|
+
compile "org.embulk.base.restclient:embulk-base-restclient:0.5.3"
|
30
|
+
compile "org.embulk.base.restclient:embulk-util-retryhelper-jetty92:0.5.3"
|
31
31
|
// compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
|
32
32
|
|
33
33
|
testCompile "junit:junit:4.+"
|
@@ -140,8 +140,8 @@ public abstract class MailChimpAbstractRecordBuffer
|
|
140
140
|
catch (JsonProcessingException jpe) {
|
141
141
|
throw new DataException(jpe);
|
142
142
|
}
|
143
|
-
|
144
|
-
|
143
|
+
catch (Exception ex) {
|
144
|
+
throw Throwables.propagate(ex);
|
145
145
|
}
|
146
146
|
}
|
147
147
|
|
@@ -202,11 +202,6 @@ public abstract class MailChimpAbstractRecordBuffer
|
|
202
202
|
return categories;
|
203
203
|
}
|
204
204
|
|
205
|
-
/**
|
206
|
-
* Clean up.
|
207
|
-
*/
|
208
|
-
abstract void cleanUp();
|
209
|
-
|
210
205
|
/**
|
211
206
|
* Push payload data to MailChimp API and get @{@link ReportResponse}
|
212
207
|
*
|
@@ -31,7 +31,6 @@ public class MailChimpHttpClient
|
|
31
31
|
private final ObjectMapper jsonMapper = new ObjectMapper()
|
32
32
|
.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, false)
|
33
33
|
.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
34
|
-
private Jetty92RetryHelper retryHelper;
|
35
34
|
|
36
35
|
/**
|
37
36
|
* Instantiates a new Mailchimp http client.
|
@@ -40,17 +39,6 @@ public class MailChimpHttpClient
|
|
40
39
|
*/
|
41
40
|
public MailChimpHttpClient(MailChimpOutputPluginDelegate.PluginTask task)
|
42
41
|
{
|
43
|
-
retryHelper = createRetryHelper(task);
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Close @{@link Jetty92RetryHelper} connection
|
48
|
-
*/
|
49
|
-
public void close()
|
50
|
-
{
|
51
|
-
if (retryHelper != null) {
|
52
|
-
retryHelper.close();
|
53
|
-
}
|
54
42
|
}
|
55
43
|
|
56
44
|
public JsonNode sendRequest(final String endpoint, final HttpMethod method,
|
@@ -62,44 +50,50 @@ public class MailChimpHttpClient
|
|
62
50
|
public JsonNode sendRequest(final String endpoint, final HttpMethod method, final String content,
|
63
51
|
final MailChimpOutputPluginDelegate.PluginTask task)
|
64
52
|
{
|
65
|
-
final
|
53
|
+
try (final Jetty92RetryHelper retryHelper = createRetryHelper(task)) {
|
54
|
+
final String authorizationHeader = getAuthorizationHeader(task);
|
66
55
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
{
|
71
|
-
@Override
|
72
|
-
public void requestOnce(HttpClient client, Response.Listener responseListener)
|
56
|
+
String responseBody = retryHelper.requestWithRetry(
|
57
|
+
new StringJetty92ResponseEntityReader(task.getTimeoutMillis()),
|
58
|
+
new Jetty92SingleRequester()
|
73
59
|
{
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
60
|
+
@Override
|
61
|
+
public void requestOnce(HttpClient client, Response.Listener responseListener)
|
62
|
+
{
|
63
|
+
Request request = client
|
64
|
+
.newRequest(endpoint)
|
65
|
+
.accept("application/json")
|
66
|
+
.method(method);
|
67
|
+
if (method == HttpMethod.POST || method == HttpMethod.PUT) {
|
68
|
+
request.content(new StringContentProvider(content), "application/json;utf-8");
|
69
|
+
}
|
70
|
+
|
71
|
+
if (!authorizationHeader.isEmpty()) {
|
72
|
+
request.header("Authorization", authorizationHeader);
|
73
|
+
}
|
74
|
+
request.send(responseListener);
|
80
75
|
}
|
81
76
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
77
|
+
@Override
|
78
|
+
public boolean isResponseStatusToRetry(Response response)
|
79
|
+
{
|
80
|
+
int status = response.getStatus();
|
87
81
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
82
|
+
if (status == 404) {
|
83
|
+
LOG.error("Exception occurred while sending request: {}", response.getReason());
|
84
|
+
throw new ConfigException("The `list id` could not be found.");
|
85
|
+
}
|
92
86
|
|
93
|
-
|
94
|
-
LOG.error("Exception occurred while sending request: {}", response.getReason());
|
95
|
-
throw new ConfigException("The `list id` could not be found.");
|
87
|
+
return status == 429 || status / 100 != 4;
|
96
88
|
}
|
89
|
+
});
|
97
90
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
91
|
+
return responseBody != null && !responseBody.isEmpty() ? parseJson(responseBody) : MissingNode.getInstance();
|
92
|
+
}
|
93
|
+
catch (Exception ex) {
|
94
|
+
LOG.info("Exception occurred while sending request.");
|
95
|
+
throw Throwables.propagate(ex);
|
96
|
+
}
|
103
97
|
}
|
104
98
|
|
105
99
|
private JsonNode parseJson(final String json)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thang Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,9 +88,9 @@ files:
|
|
88
88
|
- test/embulk/output/test_mailchimp.rb
|
89
89
|
- test/override_assert_raise.rb
|
90
90
|
- test/run-test.rb
|
91
|
-
- classpath/embulk-base-restclient-0.5.
|
92
|
-
- classpath/embulk-output-mailchimp-0.3.
|
93
|
-
- classpath/embulk-util-retryhelper-jetty92-0.5.
|
91
|
+
- classpath/embulk-base-restclient-0.5.3.jar
|
92
|
+
- classpath/embulk-output-mailchimp-0.3.13.jar
|
93
|
+
- classpath/embulk-util-retryhelper-jetty92-0.5.3.jar
|
94
94
|
- classpath/jetty-client-9.2.14.v20151106.jar
|
95
95
|
- classpath/jetty-http-9.2.14.v20151106.jar
|
96
96
|
- classpath/jetty-io-9.2.14.v20151106.jar
|