Skip to content

Commit 726ff9d

Browse files
authored
Merge pull request gchq#403 from gchq/dev
Dev
2 parents 59e9e73 + 83b8f2a commit 726ff9d

File tree

13 files changed

+49
-27
lines changed

13 files changed

+49
-27
lines changed

Diff for: build.gradle

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ buildscript {
88
dependencies {
99
classpath group: 'gchq', name: 'urlDependencyPlugin', version: 'v0.1'
1010
classpath group: 'ca.cutterslade.gradle', name: 'gradle-dependency-analyze', version: '1.1.0'
11-
classpath 'com.benjaminsproule:swagger-gradle-plugin:+'
1211
}
1312
}
1413

1514
plugins {
15+
//plugin for downloading content from the 'net
1616
id "de.undercouch.download" version "3.2.0"
17+
18+
//plugin for producing a tree of task dependencies, run task 'taskTree'
19+
id "com.dorongold.task-tree" version "1.3"
1720
}
1821

1922
apply plugin: 'gchq.urldependencies'
@@ -126,7 +129,6 @@ ext.libs = [
126129
hamcrest_core: "org.hamcrest:hamcrest-core:1.3",
127130
hbase: "org.apache.hbase:hbase-common:1.2.1", //should be set to be consistent with CDH version
128131
hessian: "com.caucho:hessian:4.0.38",
129-
hibernate_annotations: "org.hibernate:hibernate-annotations:3.5.6-Final" /* LATEST 5.2.5.Final */,
130132
hibernate_core: "org.hibernate:hibernate-core:$versions.hibernate" /* LATEST 5.2.5.Final */,
131133
hibernate_entitymanager: "org.hibernate:hibernate-entitymanager:$versions.hibernate" /* LATEST 5.2.5.Final */,
132134
hibernate_jpa_api: "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final",
@@ -184,9 +186,7 @@ ext.libs = [
184186
spring_web: "org.springframework:spring-web:$versions.spring", //was 4.2.1.RELEASE now 4.3.4.RELEASE
185187
spring_webmvc: "org.springframework:spring-webmvc:$versions.spring",
186188
stax_api: "stax:stax-api:1.0.1",
187-
//swagger_jersey2_jaxrs: "io.swagger:swagger-jersey2-jaxrs:$versions.swagger",
188189
swagger_annotations: "io.swagger:swagger-annotations:$versions.swagger",
189-
//swagger_core: "io.swagger:swagger-core:$versions.swagger",
190190
validation_api: "javax.validation:validation-api:1.0.0.GA", //GWT 2.8.0 throws errors on gwtCompile if validation-api 1.1.0.Final is used
191191
vavr: "io.vavr:vavr:0.9.0",
192192
ws_rs_api: "javax.ws.rs:javax.ws.rs-api:2.0.1",
@@ -210,7 +210,7 @@ ext.contentPacks = [
210210
]
211211

212212
task wrapper(type: Wrapper) {
213-
gradleVersion = '3.5'
213+
gradleVersion = '4.1'
214214
}
215215

216216
allprojects {
@@ -223,6 +223,10 @@ allprojects {
223223

224224
subprojects {
225225
apply plugin: 'java'
226+
227+
//sourceSets {
228+
//logger.info "main.output.classesDirs: " + main.output.classesDirs
229+
//}
226230

227231
//analyze missing dependencies for the code base
228232
apply plugin: 'ca.cutterslade.analyze'
@@ -284,6 +288,8 @@ subprojects {
284288
}
285289
}
286290

291+
//ensure we download our libs before compiling java
292+
tasks.compileJava.dependsOn downloadUrlDependencies
287293
}
288294

289295

@@ -390,3 +396,4 @@ urlDependencies {
390396
"https://github.com/gchq/hadoop-common-shaded/releases/download/$versions.hadoopCommonShaded/${urlLibs.hadoopCommonShaded}.jar")
391397
}
392398

399+

Diff for: gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.

Diff for: gradle/wrapper/gradle-wrapper.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Aug 11 09:22:55 BST 2017
1+
#Fri Sep 08 13:37:38 BST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip

Diff for: stroom-app-gwt/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies {
3535
def gwtSourceDirs = []
3636
parent.subprojects.each { p ->
3737
if (p.name != 'stroom-dashboard-gwt') {
38-
gwtSourceDirs.add(p.sourceSets.main.output.classesDir)
38+
gwtSourceDirs.addAll(p.sourceSets.main.output.classesDirs)
3939
gwtSourceDirs.addAll(p.sourceSets.main.java.srcDirs)
4040
gwtSourceDirs.addAll(p.sourceSets.main.resources.srcDirs)
4141
}

Diff for: stroom-app/build.gradle

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '1.2.4'
2+
id 'com.github.johnrengelman.shadow' version '1.2.4'
3+
id "com.benjaminsproule.swagger" version "0.1.4"
34
}
45

56
def swaggerDir = "${projectDir}/src/main/resources/swagger"
67

78
apply plugin: 'application'
8-
apply plugin: 'com.benjaminsproule.swagger'
9+
apply plugin: 'java'
910
mainClassName = 'stroom.startup.App'
1011

1112
jar {
1213
//we need to first generate the swagger spec files so they can be added in to the jar
13-
dependsOn generateSwaggerDocumentation
14+
mustRunAfter generateSwaggerDocumentation
1415

1516
manifest {
1617
attributes(
@@ -147,7 +148,7 @@ sourceSets {
147148

148149
// This task lets us run the actual integration tests.
149150
task integrationTest(type: Test) {
150-
testClassesDir = sourceSets.integrationTest.output.classesDir
151+
testClassesDirs = sourceSets.integrationTest.output.classesDirs
151152
classpath = sourceSets.integrationTest.runtimeClasspath
152153
}
153154

@@ -172,8 +173,8 @@ runShadow {
172173
//The gwtCompile tasks create files in stroom-app/src/main/resources/ui
173174
//so those tasks MUST be run first else this jar and the fat jar will be
174175
//missing all the GWT generated files and the UI will fail to start
175-
processResources.dependsOn(':stroom-app-gwt:gwtCompile')
176-
processResources.dependsOn(':stroom-dashboard-gwt:gwtCompile')
176+
processResources.mustRunAfter(':stroom-app-gwt:gwtCompile')
177+
processResources.mustRunAfter(':stroom-dashboard-gwt:gwtCompile')
177178

178179
swagger {
179180
apiSource {
@@ -206,3 +207,5 @@ swagger {
206207
}
207208
}
208209

210+
tasks.build.dependsOn generateSwaggerDocumentation
211+
tasks.build.dependsOn shadowJar

Diff for: stroom-app/src/main/java/stroom/servicediscovery/ServiceDiscovererImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public HealthCheck.Result getHealth() {
136136
.withMessage("%s service(s) have no registered instances");
137137
} else {
138138
builder.healthy()
139-
.withMessage("All external services available");
139+
.withMessage("All services (local and remote) available");
140140
}
141141
return builder.withDetail("discovered-service-instances", serviceInstanceMap)
142142
.build();

Diff for: stroom-app/src/main/java/stroom/servicediscovery/ServiceDiscoveryRegistrar.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ private String getHostOrIp(final StroomPropertyService stroomPropertyService) {
6969

7070
private void curatorStartupListener(ServiceDiscovery<String> serviceDiscovery) {
7171
try {
72-
StringBuilder stringBuilder = new StringBuilder();
73-
stringBuilder.append("Successfully registered the following services: ");
74-
7572
Map<String, String> services = new TreeMap<>();
7673
Arrays.stream(RegisteredService.values())
7774
.forEach(registeredService -> {
@@ -83,7 +80,7 @@ private void curatorStartupListener(ServiceDiscovery<String> serviceDiscovery) {
8380

8481
health = HealthCheck.Result.builder()
8582
.healthy()
86-
.withMessage("Services registered")
83+
.withMessage("Local services registered")
8784
.withDetail("registered-services", services)
8885
.build();
8986

Diff for: stroom-core-server/src/main/resources/META-INF/spring/stroomCoreServerPropertyContext.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@
935935
</bean>
936936
<bean class="stroom.node.shared.GlobalProperty">
937937
<property name="name" value="stroom.services.stroomStats.version"/>
938-
<property name="value" value="1"/>
938+
<property name="value" value="2"/>
939939
<property name="description"
940940
value="The version of the stroom-stats service" />
941941
<property name="editable" value="true"/>
@@ -1039,7 +1039,7 @@
10391039
<property name="value"
10401040
value="localhost:2181"/>
10411041
<property name="description"
1042-
value="The Zookeeper quorum connection string, required for service discovery" />
1042+
value="The Zookeeper quorum connection string, required for service discovery, in the form 'host1:port1,host2:port2,host3:port3'. The root znode to use in Zookeeper is defined in the property stroom.serviceDiscovery.zookeeperBasePath" />
10431043
<property name="editable" value="true"/>
10441044
<property name="requireUiRestart" value="true"/>
10451045
</bean>

Diff for: stroom-dashboard-gwt/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
def gwtSourceDirs = []
3333
parent.subprojects.each { p ->
3434
if (p.name != 'stroom-app-gwt') {
35-
gwtSourceDirs.add(p.sourceSets.main.output.classesDir)
35+
gwtSourceDirs.addAll(p.sourceSets.main.output.classesDirs)
3636
gwtSourceDirs.addAll(p.sourceSets.main.java.srcDirs)
3737
gwtSourceDirs.addAll(p.sourceSets.main.resources.srcDirs)
3838
}

Diff for: stroom-pipeline/src/main/java/stroom/kafka/filter/KafkaProducerFilter.java

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class KafkaProducerFilter extends AbstractSamplingFilter {
6161

6262
private String topic;
6363
private String recordKey;
64+
private StroomKafkaProducer.FlushMode flushMode;
6465

6566
@Inject
6667
public KafkaProducerFilter(final ErrorReceiverProxy errorReceiverProxy,
@@ -96,4 +97,9 @@ public void setRecordKey(final String recordKey) {
9697
public void setTopic(final String topic) {
9798
this.topic = pathCreator.replaceAll(topic);
9899
}
100+
101+
@PipelineProperty(description="Flush the producer each time a message is sent")
102+
public void setFlushOnSend(final boolean flushMode) {
103+
this.flushMode = flushMode ? StroomKafkaProducer.FlushMode.FLUSH_ON_SEND : StroomKafkaProducer.FlushMode.NO_FLUSH;
104+
}
99105
}

Diff for: stroom-pipeline/src/main/java/stroom/pipeline/destination/RollingKafkaDestination.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class RollingKafkaDestination extends RollingDestination {
1616

1717
private final String topic;
1818
private final String recordKey;
19+
private final StroomKafkaProducer.FlushMode flushMode;
1920

2021
private StringBuilder data = new StringBuilder();
2122

@@ -25,11 +26,13 @@ public RollingKafkaDestination(final String key,
2526
final long creationTime,
2627
final StroomKafkaProducer stroomKafkaProducer,
2728
final String recordKey,
28-
final String topic) {
29+
final String topic,
30+
final StroomKafkaProducer.FlushMode flushMode) {
2931
super(key, frequency, maxSize, creationTime);
3032
this.stroomKafkaProducer = stroomKafkaProducer;
3133
this.recordKey = recordKey;
3234
this.topic = topic;
35+
this.flushMode = flushMode;
3336

3437
setOutputStream(new ByteCountOutputStream(new OutputStream() {
3538
@Override
@@ -49,7 +52,7 @@ void onHeaderWritten(final ByteCountOutputStream outputStream,
4952
void onFooterWritten(final Consumer<Throwable> exceptionConsumer) {
5053
final ProducerRecord<String, String> newRecord = new ProducerRecord<>(topic, recordKey, data.toString());
5154
try {
52-
stroomKafkaProducer.send(newRecord, StroomKafkaProducer.FlushMode.FLUSH_ON_SEND, e -> {
55+
stroomKafkaProducer.send(newRecord, flushMode, e -> {
5356
LOGGER.error("Unable to send record to Kafka!", e);
5457
});
5558
} catch (RuntimeException e) {

Diff for: stroom-pipeline/src/main/java/stroom/pipeline/server/writer/RollingKafkaAppender.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import stroom.util.spring.StroomScope;
1414

1515
import javax.annotation.Resource;
16-
import javax.inject.Inject;
1716
import java.io.IOException;
1817

1918
@Component
@@ -31,6 +30,7 @@ public class RollingKafkaAppender extends AbstractRollingAppender {
3130

3231
private String topic;
3332
private String recordKey;
33+
private StroomKafkaProducer.FlushMode flushMode;
3434

3535
private String key;
3636

@@ -62,7 +62,8 @@ public RollingDestination createDestination() throws IOException {
6262
System.currentTimeMillis(),
6363
stroomKafkaProducer,
6464
recordKey,
65-
topic);
65+
topic,
66+
flushMode);
6667
}
6768

6869
@PipelineProperty(description = "The record key to apply to records, used to select patition. Replacement variables can be used in path strings such as ${feed}.")
@@ -74,4 +75,9 @@ public void setRecordKey(final String recordKey) {
7475
public void setTopic(final String topic) {
7576
this.topic = pathCreator.replaceAll(topic);
7677
}
78+
79+
@PipelineProperty(description="Flush the producer each time a message is sent")
80+
public void setFlushOnSend(final boolean flushOnSend) {
81+
this.flushMode = flushOnSend ? StroomKafkaProducer.FlushMode.FLUSH_ON_SEND : StroomKafkaProducer.FlushMode.NO_FLUSH;
82+
}
7783
}

Diff for: stroom-security-shared/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66

77
compile libs.hibernate_jpa_api
88
compile libs.validation_api
9-
compile libs.hibernate_annotations
9+
compile libs.hibernate_core
1010

1111
testCompile libs.junit
1212

0 commit comments

Comments
 (0)