Skip to content

Commit

Permalink
Merge branch 'release/1.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Roeser committed Dec 27, 2018
2 parents 71f9fa0 + 2e6ab17 commit 30e718d
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
sudo: required
jdk: oraclejdk8
jdk: openjdk11
script: ci/travis.sh
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
22 changes: 19 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ allprojects {
apply plugin: 'net.saliman.properties'

ext {
proteusVersion = '1.5.2'
proteusVersion = '1.5.3'
protobufVersion = '3.6.1'
rsocketRpcVersion = '0.2.10'
springBootDependenciesVersion = '2.0.5.RELEASE'
rsocketRpcVersion = '0.2.12'
springBootDependenciesVersion = '2.1.1.RELEASE'
}

project.version += project.hasProperty('versionSuffix') ? project.property('versionSuffix') : ''
Expand All @@ -49,6 +49,22 @@ allprojects {
maven {
url "https://dl.bintray.com/rsocket-admin/RSocket"
}

maven {
url = 'https://artifactory.netifiinc.com/artifactory/libs-release-local'
credentials {
username = project.hasProperty('netifiArtifactoryUsername') ? project.property('netifiArtifactoryUsername') : System.getenv('NETIFI_ARTIFACTORY_USERNAME')
password = project.hasProperty('netifiArtifactoryPassword') ? project.property('netifiArtifactoryPassword') : System.getenv('NETIFI_ARTIFACTORY_PASSWORD')
}
}

maven {
url = 'https://artifactory.netifiinc.com/artifactory/libs-snapshot-local'
credentials {
username = project.hasProperty('netifiArtifactoryUsername') ? project.property('netifiArtifactoryUsername') : System.getenv('NETIFI_ARTIFACTORY_USERNAME')
password = project.hasProperty('netifiArtifactoryPassword') ? project.property('netifiArtifactoryPassword') : System.getenv('NETIFI_ARTIFACTORY_PASSWORD')
}
}
}

license {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,30 @@
*/
package io.netifi.proteus.demo.vowelcount;

import io.netifi.proteus.springboot.ProteusConfigurer;
import io.rsocket.transport.netty.client.TcpClientTransport;
import reactor.netty.tcp.TcpClient;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Application {

public static void main(String... args) {
SpringApplication.run(Application.class, args);
}


@Bean
public ProteusConfigurer proteusConfigurer() {
return builder ->
builder.clientTransportFactory(address -> {
TcpClient client = TcpClient.create()
.addressSupplier(() -> address);
return TcpClientTransport.create(client);
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,20 @@
*/
package io.netifi.proteus.demo.vowelcount.service;

import java.util.concurrent.atomic.AtomicLong;

import io.netifi.proteus.demo.isvowel.service.IsVowelRequest;
import io.netifi.proteus.demo.isvowel.service.IsVowelResponse;
import io.netifi.proteus.demo.isvowel.service.IsVowelService;
import io.netifi.proteus.demo.isvowel.service.IsVowelServiceClient;
import io.netifi.proteus.spring.core.annotation.Group;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicLong;

/**
* Service that receives messages and keeps track of the number of vowels found in those messages.
*/
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=io.netifi.proteus
version=1.5.2
version=1.5.3
3 changes: 3 additions & 0 deletions proteus-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ dependencies {
compile project(":proteus-spring-core")

compile "io.netifi.proteus:proteus-client:${proteusVersion}"
compileClasspath "io.netifi.proteus:proteus-metrics-micrometer:${proteusVersion}"
compileClasspath "io.netifi.proteus:proteus-tracing-openzipkin:${proteusVersion}"

compile 'org.slf4j:slf4j-api'
compile 'org.springframework.boot:spring-boot-autoconfigure'
Expand All @@ -27,6 +29,7 @@ dependencies {
compile 'io.micrometer:micrometer-core:1.0.6'

annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor"

testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.mockito:mockito-core'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,99 @@
*/
package io.netifi.proteus.springboot;

import java.util.function.Supplier;
import java.util.List;
import java.util.Optional;

import io.micrometer.core.instrument.MeterRegistry;
import io.netifi.proteus.Proteus;
import io.netifi.proteus.micrometer.ProteusMeterRegistrySupplier;
import io.netifi.proteus.spring.core.config.ProteusConfiguration;
import io.netifi.proteus.tracing.ProteusTracerSupplier;
import io.opentracing.Tracer;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.annotation.Order;
import org.springframework.util.StringUtils;

@SpringBootConfiguration
@EnableConfigurationProperties(ProteusProperties.class)
@AutoConfigureBefore(ProteusConfiguration.class)
public class ProteusAutoConfiguration {

@Bean
@Conditional(MeterRegistrySupplierCondition.class)
public MeterRegistry meterRegistry(Supplier<MeterRegistry> supplier) {
return supplier.get();
@Bean(name = "internalScanClassPathBeanDefinitionRegistryPostProcessor")
public BeanDefinitionRegistryPostProcessor scanClassPathBeanDefinitionRegistryPostProcessor(ApplicationContext applicationContext) throws BeansException {
return new ScanClassPathBeanDefinitionRegistryPostProcessor();
}

@Bean
@Conditional(TracerSupplierCondition.class)
public Tracer tracer(Supplier<Tracer> supplier) {
return supplier.get();
@Order(Ordered.HIGHEST_PRECEDENCE)
public ProteusConfigurer propertiesBasedProteusConfigurer(ProteusProperties proteusProperties) {
return builder -> {
ProteusProperties.SslProperties ssl = proteusProperties.getSsl();
ProteusProperties.AccessProperties access = proteusProperties.getAccess();
ProteusProperties.BrokerProperties broker = proteusProperties.getBroker();

if (!StringUtils.isEmpty(proteusProperties.getDestination())) {
builder.destination(proteusProperties.getDestination());
}

return builder.sslDisabled(ssl.isDisabled())
.accessKey(access.getKey())
.accessToken(access.getToken())
.group(proteusProperties.getGroup())
.poolSize(proteusProperties.getPoolSize())
.host(broker.getHostname())
.port(broker.getPort());
};
}

@Bean(name = "internalScanClassPathBeanDefinitionRegistryPostProcessor")
public BeanDefinitionRegistryPostProcessor scanClassPathBeanDefinitionRegistryPostProcessor(ApplicationContext applicationContext) throws BeansException {
return new ScanClassPathBeanDefinitionRegistryPostProcessor();
@SpringBootConfiguration
@ConditionalOnMissingBean(MeterRegistry.class)
@ConditionalOnClass(ProteusMeterRegistrySupplier.class)
public static class MetricsConfigurations {

@Bean
public MeterRegistry meterRegistry(
Proteus proteus,
ProteusProperties properties
) {
return new ProteusMeterRegistrySupplier(
proteus,
Optional.of(properties.getMetrics().getGroup()),
Optional.of(properties.getMetrics().getReportingStepInMillis()),
Optional.of(properties.getMetrics().isExport())
).get();
}
}


@SpringBootConfiguration
@ConditionalOnMissingBean(Tracer.class)
@ConditionalOnClass(ProteusTracerSupplier.class)
public static class TracingConfigurations {

@Bean
public Tracer tracer(
Proteus proteus,
ProteusProperties properties
) {
return new ProteusTracerSupplier(
proteus,
Optional.of(properties.getTracing().getGroup())
).get();
}
}

@SpringBootConfiguration
Expand All @@ -63,8 +116,10 @@ public BeanDefinitionRegistryPostProcessor scanClassPathBeanDefinitionRegistryPo
public static class NonWebProteusConfiguration {

@Bean
public Proteus proteus(ProteusProperties proteusProperties) {
Proteus proteus = configureProteus(proteusProperties);
public Proteus proteus(
List<ProteusConfigurer> configurers
) {
Proteus proteus = configureProteus(configurers);

startDaemonAwaitThread(proteus);

Expand Down Expand Up @@ -92,31 +147,23 @@ public void run() {
public static class WebProteusConfiguration {

@Bean
public Proteus proteus(ProteusProperties proteusProperties) {
return configureProteus(proteusProperties);
public Proteus proteus(
List<ProteusConfigurer> configurers
) {
return configureProteus(configurers);
}
}


static Proteus configureProteus(ProteusProperties proteusProperties) {
ProteusProperties.SslProperties ssl = proteusProperties.getSsl();
ProteusProperties.AccessProperties access = proteusProperties.getAccess();
ProteusProperties.BrokerProperties broker = proteusProperties.getBroker();

static Proteus configureProteus(List<ProteusConfigurer> configurers) {
Proteus.Builder builder = Proteus.builder();

if (!StringUtils.isEmpty(proteusProperties.getDestination())) {
builder.destination(proteusProperties.getDestination());
AnnotationAwareOrderComparator.sort(configurers);

for (ProteusConfigurer configurer : configurers) {
builder = configurer.configure(builder);
}

return builder
.sslDisabled(ssl.isDisabled())
.accessKey(access.getKey())
.accessToken(access.getToken())
.group(proteusProperties.getGroup())
.poolSize(proteusProperties.getPoolSize())
.host(broker.getHostname())
.port(broker.getPort())
.build();
return builder.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright 2018 Netifi Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.netifi.proteus.springboot;

import io.netifi.proteus.Proteus;

@FunctionalInterface
public interface ProteusConfigurer {

Proteus.Builder configure(Proteus.Builder builder);
}
Loading

0 comments on commit 30e718d

Please sign in to comment.