This file contains hidden or 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
| @EnableBinding(Sink.class) | |
| public class ConsumerApplication { | |
| @StreamListener(Sink.INPUT) | |
| public void loggerSink(Message<User> message) { | |
| logger.info("Received: " + message.getPayload().getUsername()); | |
| // Save to READ datastore | |
| } | |
This file contains hidden or 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
| @EnableBinding(Source.class) | |
| @Autowired | |
| private MessageChannel output; |
This file contains hidden or 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
| class UserListener extends AbstractMongoEventListener<User> { | |
| ...... | |
| @Override | |
| public void onAfterSave(AfterSaveEvent<User> event) { | |
| ... | |
| } | |
| @Override | |
| public void onAfterDelete(AfterDeleteEvent<User> event) { | |
| ... |
This file contains hidden or 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
| db = db.getSisterDB("config"); | |
| var mongosConn = db; // assume we connected to a mongos to get going | |
| var res = null; | |
| function check() { | |
| printjson(res); | |
| if( !res || !res.ok ) { | |
| throw "check(): not ok, stopping"; |
This file contains hidden or 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
| # install Elasticsearch | |
| sudo add-apt-repository -y ppa:webupd8team/java | |
| sudo apt-get update | |
| sudo apt-get -y install oracle-java8-installer | |
| wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add - | |
| echo 'deb http://packages.elasticsearch.org/elasticsearch/1.5/debian stable main' | sudo tee /etc/apt/sources.list.d/ela | |
| sticsearch.list | |
| sudo apt-get update | |
| sudo apt-get -y install elasticsearch=1.5.2 |
This file contains hidden or 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
| RestTemplate restTemplate = new RestTemplate(); | |
| ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class); | |
| HttpStatus status = response.getStatusCode(); |
This file contains hidden or 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
| RestTemplate restTemplate = new RestTemplate(); | |
| HttpHeaders headers = new HttpHeaders(); | |
| headers.set("Accept", MediaType.APPLICATION_JSON_VALUE); | |
| UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl) | |
| .queryParam("applicationName", "appName"); | |
| HttpEntity<?> entity = new HttpEntity<>(headers); |
This file contains hidden or 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
| RestTemplate restTemplate = new RestTemplate(); | |
| ParameterizedTypeReference<List<String>> listOfStrings = new ParameterizedTypeReference<List<String>>() {}; | |
| ResponseEntity<List<String>> response = restTemplate.exchange(baseUrl,HttpMethod.GET,null,listOfStrings); |
This file contains hidden or 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
| RestTemplate restTemplate = new RestTemplate(); | |
| ParameterizedTypeReference<List<String>> listOfString = new ParameterizedTypeReference<List<String>>() {}; | |
| ResponseEntity<List<String>> response= restTemplate.exchange(baseUrl,HttpMethod.GET,null, listOfString); | |
| HttpHeaders headers = response.getHeaders(); | |
| MediaType contentType = headers.getContentType(); | |
| long date = headers.getDate(); | |
| List<String> getOrDefault = headers.getOrDefault("X-Forwarded", Collections.singletonList("Does not exists")); |
This file contains hidden or 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
| RestTemplate restTemplate = new RestTemplate(); | |
| URI location = restTemplate.postForLocation(baseUrl, null); |