Slide 1

Slide 1 text

1 © 2018 Pivotal Testing your Message-Driven Application with Spring Jakub Pilimon, @JakubPilimon https://github.com/spring-cloud-samples/messaging-application

Slide 2

Slide 2 text

2 Spring Developer Advocate @Pivotal Trainer @Bottega Interested in ● Domain-Driven Design ● Architecture ● Test-Driven Development About me Twitter: @JakubPilimon Blog: http://pillopl.github.io #dddbyexamples

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

4 ● Temporal coupling ● Throttling ● Broadcast/multicast ● Spatial coupling ● Logical coupling Why Messaging?

Slide 5

Slide 5 text

5 Why Messaging? CREDIT CARD APPLICATION CONTROLLER APPLY FOR CARD SERVICE CREDIT CARD DOMAIN EVENT PUBLISHER CREDIT CARD REPOSITORY CONSUMER (MAIL, REPORT, ETC)

Slide 6

Slide 6 text

6

Slide 7

Slide 7 text

7

Slide 8

Slide 8 text

8 Why Messaging? CREDIT CARD APPLICATION CONTROLLER APPLY FOR CARD SERVICE CREDIT CARD DOMAIN EVENT PUBLISHER CREDIT CARD REPOSITORY CONSUMER (MAIL, REPORT, ETC) def 'should emit CardGranted when client born in 70s or later'() { when: applyForCardService.apply("89121514667") then: 1 * domainEventsPublisher.publish( { it instanceof CardGranted } ) }

Slide 9

Slide 9 text

9 Why Messaging? CREDIT CARD APPLICATION CONTROLLER APPLY FOR CARD SERVICE CREDIT CARD DOMAIN EVENT PUBLISHER CREDIT CARD REPOSITORY CONSUMER (MAIL, REPORT, ETC) @Test public void shouldEmitCardGrantedEvent() { // when cardApplicationController.applyForCard(new CardApplication("70345678")); // then verify(domainEventsPublisher).publish(isA(CardGranted.class)); }

Slide 10

Slide 10 text

10 Why Messaging? CREDIT CARD APPLICATION CONTROLLER APPLY FOR CARD SERVICE CREDIT CARD DOMAIN EVENT PUBLISHER CREDIT CARD REPOSITORY CONSUMER (MAIL, REPORT, ETC) def 'should be able to get card when born in 70s or later'() { when: cardApplicationController.applyForCard(new CardApplication("70345678")) then: events.poll().getPayload().contains("card-granted") }

Slide 11

Slide 11 text

11

Slide 12

Slide 12 text

12 Why Messaging? CREDIT CARD APPLICATION CONTROLLER APPLY FOR CARD SERVICE CREDIT CARD DOMAIN EVENT PUBLISHER CREDIT CARD REPOSITORY CONSUMER (MAIL, REPORT, ETC) label: card_rejected input: triggeredBy: sendRejected() outputMessage: sentTo: channel headers: type: card-application-rejected contentType: application/json body: clientPesel: 86010156812 timestamp: 2018-01-01T12:12:12.000Z matchers: body: - path: $.timestamp type: by_regex predefined: iso_8601_with_offset

Slide 13

Slide 13 text

13

Slide 14

Slide 14 text

14 Learn More. Stay Connected. Twitter: twitter.com/springcentral YouTube: spring.io/video LinkedIn: spring.io/linkedin Google Plus: spring.io/gplus

Slide 15

Slide 15 text

15 QUESTIONS

Slide 16

Slide 16 text

16 JakubPilimon