This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <PubSubClient.h> | |
#include <dht.h> | |
// Update these with values suitable for your network. | |
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; | |
IPAddress ip(192, 168, 1, 5); | |
IPAddress server(192, 168, 1, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find All, Subscribe, Be Active until disposed or completed. | |
Disposable subscription = taxiRepository.findWithTailableCursorBy() | |
.doOnNext(System.out::println) | |
.doOnComplete(() -> System.out.println("Finished")) | |
.doOnTerminate(() -> System.out.println("Terminated")) | |
.subscribe(); | |
Thread.sleep(1000); | |
taxiRepository.save(new Taxi(UUID.randomUUID().toString(), "ABC-1234", 4)).subscribe(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find by Number, Aggregate to a List, Block until finish | |
List myTaxis = rxJava2TaxiRepository | |
.findByNumber("CAL-4259") | |
.toList() | |
.blockingGet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find by Number, Aggregate to a List, Block until finish | |
List myTaxis = taxiRepository | |
.findByNumber("CAL-4259") | |
.collectList() | |
.block(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface RxJava2TaxiRepository | |
extends RxJava2CrudRepository { | |
Flowable findByNumber(String taxiNumber); | |
@Tailable | |
Flowable findWithTailableCursorBy(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ReactiveTaxiRepository | |
extends ReactiveCrudRepository { | |
Flux findByNumber(String taxiNumber); | |
@Tailable | |
Flux findWithTailableCursorBy(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication(exclude = {MongoAutoConfiguration.class, | |
MongoDataAutoConfiguration.class }) | |
@EnableReactiveMongoRepositories | |
@AutoConfigureAfter(EmbeddedMongoAutoConfiguration.class) | |
public class ApplicationConfiguration | |
extends AbstractReactiveMongoConfiguration { | |
private final Environment environment; | |
public ApplicationConfiguration(Environment environment) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId> | |
<version>2.0.0.M6</version> | |
</dependency> | |
<dependency> | |
<groupId>io.reactivex.rxjava2</groupId> | |
<artifactId>rxjava</artifactId> | |
<version>2.1.1</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"chain": [ | |
{ | |
"index": 1, | |
"timestamp": 1507040257518, | |
"transactions": [], | |
"proof": 100, | |
"previousHash": "1" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("/people") | |
public class PeopleController { | |
@Autowired | |
private PersonService blockingService; | |
@GetMapping | |
public Flux<Person> getPeople() { | |
return Flux.fromIterable(blockingService.getPeople()); |
NewerOlder