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
| public class ResultServiceActivator { | |
| @ServiceActivator(inputChannel = "personOutput") | |
| public void handle(Person person) { | |
| System.out.println(String.format("Person retrieved: %s", person)); | |
| } | |
| } |
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
| @ComponentScan("xpadro.spring.integration.mongodb") | |
| @IntegrationComponentScan("xpadro.spring.integration.mongodb") | |
| public class JavaConfigQueryConfiguration { | |
| @MessagingGateway | |
| public interface PersonService { | |
| @Gateway(requestChannel = "personInput") | |
| void send(RequestMessage requestMessage); | |
| } |
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
| personService.send(new RequestMessage("{id : 3}")); |
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
| public void handle(List<Person> persons) { | |
| String names = persons.stream().map(Person::getName).collect(Collectors.joining(", ")); | |
| System.out.println(String.format("Persons retrieved: %s", names)); | |
| } |
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
| private MongoDbOutboundGatewaySpec outboundGateway(MongoDbFactory mongo) { | |
| return MongoDb.outboundGateway(mongo) | |
| .queryExpression("payload.data") | |
| .collectionNameExpression(new LiteralExpression("person")) | |
| .entityClass(Person.class) | |
| .maxResults(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
| personService.send(new RequestMessage("{}")); |
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
| private MongoDbOutboundGatewaySpec outboundGateway(MongoDbFactory mongo) { | |
| return MongoDb.outboundGateway(mongo) | |
| .queryExpression("payload.data") | |
| .collectionNameExpression(new LiteralExpression("person")) | |
| .expectSingleResult(true) | |
| .entityClass(Person.class); | |
| } |
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
| personService.send(new RequestMessage("{id : 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
| @SpringBootApplication | |
| @EnableIntegration | |
| @Import(JavaDSLQueryConfiguration.class) | |
| public class JavaDSLQueryApplication extends AbstractApplication { | |
| public static void main(String[] args) { | |
| ConfigurableApplicationContext context = SpringApplication.run(JavaDSLQueryApplication.class, args); | |
| new JavaDSLQueryApplication().start(context); | |
| } |
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
| public class ResultHandler { | |
| public void handle(Person person) { | |
| System.out.println(String.format("Person retrieved: %s", person)); | |
| } | |
| } |
NewerOlder