Delomboking

This commit is contained in:
Marcin Grzejszczak
2016-02-10 19:09:20 +01:00
parent 8f5f553376
commit ee8d7a54c7
68 changed files with 687 additions and 391 deletions

View File

@@ -16,14 +16,13 @@
package sample;
import lombok.SneakyThrows;
import java.util.Random;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Random;
/**
* @author Spencer Gibb
*/
@@ -35,9 +34,8 @@ public class SampleBackground {
@Autowired
private Random random;
@SneakyThrows
@Async
public void background() {
public void background() throws InterruptedException {
int millis = this.random.nextInt(1000);
Thread.sleep(millis);
this.tracer.addTag("background-sleep-millis", String.valueOf(millis));

View File

@@ -16,8 +16,7 @@
package sample;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.context.ApplicationListener;
@@ -30,10 +29,11 @@ import org.springframework.web.client.RestTemplate;
* @author Dave Syer
*
*/
@MessageEndpoint
@Slf4j
public class SampleService implements
@MessageEndpoint public class SampleService implements
ApplicationListener<EmbeddedServletContainerInitializedEvent> {
private static final Logger log = org.slf4j.LoggerFactory
.getLogger(SampleService.class);
@Autowired private RestTemplate restTemplate;
private int port;

View File

@@ -16,8 +16,7 @@
package sample;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
@@ -28,14 +27,16 @@ import org.springframework.messaging.Message;
*
*/
@MessageEndpoint
@Slf4j
public class SampleTransformer {
private static final Logger log = org.slf4j.LoggerFactory
.getLogger(SampleTransformer.class);
@Autowired
SampleBackground background;
@ServiceActivator(inputChannel="xform")
public String log(Message<?> message) {
public String log(Message<?> message) throws InterruptedException {
log.info("Received: " + message);
this.background.background();
return message.getPayload().toString().toUpperCase();

View File

@@ -15,22 +15,25 @@
*/
package integration;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
import zipkin.Span;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
import zipkin.Span;
/**
* Span Collector that logs spans and adds Spans to a list
*
* @author Marcin Grzejszczak
*/
@CommonsLog
public class IntegrationTestZipkinSpanReporter implements ZipkinSpanReporter {
private static final Log log = org.apache.commons.logging.LogFactory
.getLog(IntegrationTestZipkinSpanReporter.class);
public List<Span> hashedSpans = Collections.synchronizedList(new LinkedList<>());
@Override