Skip to content

Commit

Permalink
Flattening the project structure - now demos are available directly a…
Browse files Browse the repository at this point in the history
…t top level
  • Loading branch information
iproduct committed Dec 4, 2017
1 parent ae43fb8 commit c2ea795
Show file tree
Hide file tree
Showing 44 changed files with 67 additions and 48 deletions.
42 changes: 23 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Compiled class file
*.class
.gradle
build/
out/
!gradle/wrapper/gradle-wrapper.jar

# Log file
*.log
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans

# BlueJ files
*.ctxt
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 0 additions & 26 deletions hello-webflux/.gitignore

This file was deleted.

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@AllArgsConstructor
@EqualsAndHashCode(of = {"id"})
@ToString
@Builder
public class Quote {

private static long nextId = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.iproduct.demos.spring.reactivequotes.handlers;

import lombok.extern.slf4j.Slf4j;
import org.iproduct.demos.spring.reactivequotes.domain.Quote;
import org.iproduct.demos.spring.reactivequotes.services.QuotesGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import java.time.Duration;

import static org.springframework.http.MediaType.APPLICATION_STREAM_JSON;
import static org.springframework.http.MediaType.TEXT_EVENT_STREAM;

@Component
@Slf4j
public class ReactiveQuotesHandler {

@Autowired
private QuotesGenerator generator;


public Mono<ServerResponse> streamQuotes(ServerRequest request) {
return ServerResponse.ok()
.contentType(APPLICATION_STREAM_JSON)
.body(generator.getQuoteStream(Duration.ofMillis(250)), Quote.class);
}

public Mono<ServerResponse> streamQuotesSSE(ServerRequest request) {
return ServerResponse.ok()
.contentType(TEXT_EVENT_STREAM)
.body(generator.getQuoteStream(Duration.ofMillis(250)), Quote.class);
}

}
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include 'reactive-quotes'
include 'webflux-users'
include 'quotes-demo-app'

File renamed without changes.
3 changes: 3 additions & 0 deletions webflux-users/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.port: 8080
endpoints.sensitive=false
endpoints.metrics.enabled=true

0 comments on commit c2ea795

Please sign in to comment.