Messaging is not just for investment banks! (+ web is not the only - - PowerPoint PPT Presentation

messaging is not just for investment banks web is not the
SMART_READER_LITE
LIVE PREVIEW

Messaging is not just for investment banks! (+ web is not the only - - PowerPoint PPT Presentation

Messaging is not just for investment banks! (+ web is not the only way) Gojko Adzic http://gojko.net gojko@gojko.com twitter.com/gojkoadzic Web is now ubiquitous ... we use it to display content, to share data, for remote procedure calls,


slide-1
SLIDE 1

Messaging is not just for investment banks! (+ web is not the only way)

Gojko Adzic http://gojko.net gojko@gojko.com twitter.com/gojkoadzic

slide-2
SLIDE 2

Web is now ubiquitous

... we use it to display content, to share data, for remote procedure calls, to integrate systems...

slide-3
SLIDE 3

It started like this...

slide-4
SLIDE 4

And simply exploded...

slide-5
SLIDE 5

But why this???

slide-6
SLIDE 6

HTTP distribution/integration

 Easy to use  Cross-platform  Clustering and load balancing  Almost never blocked by firewalls  Even then works with proxying  Stateless  Synchronous  Unreliable/Non transactional  High latency

slide-7
SLIDE 7

Web technologies are not for everything...

... sometimes other stuff can save a lot of effort

http://www.flickr.com/photos/33453508@N02/

slide-8
SLIDE 8

HTTP distribution/integration

 Easy to use  Cross-platform  Clustering and load balancing  Almost never a security problem  Even then works with proxying  Stateless  Synchronous  Unreliable/Non transactional  High Latency

slide-9
SLIDE 9

Messaging

 Application integration pattern  Data transformation, routing, resilience, high

performance, high throughput

 Message oriented middleware(MOM)

slide-10
SLIDE 10

http://www.flickr.com/photos/wirenine/

slide-11
SLIDE 11

http://www.flickr.com/photos/17675967@N02/

slide-12
SLIDE 12
slide-13
SLIDE 13

http://www.flickr.com/photos/stewf/

slide-14
SLIDE 14

Messaging

 Application integration pattern  Data transformation, routing, resilience, high

performance, high throughput

 Message oriented middleware(MOM)  Event driven processing  Split workflows into several asynchronous parts  Share data instead of functionallity

− But use data to invoke actions!

slide-15
SLIDE 15

Not just for multi-billion enterprises

 Some really

lightweight solutions

  • ut there

 Can even run

everything on a single machine

 Typical web sites

can benefit from this approach as well

slide-16
SLIDE 16

Benefits

 Better isolation

− Easier scaling − Better performance

 Resilience  Responsiveness  Better resource usage

slide-17
SLIDE 17

Case Study #1: E-mail after registration/order

slide-18
SLIDE 18

Case Study #1: E-mail after registration/order

slide-19
SLIDE 19

Case Study #1: E-mail after registration/order

slide-20
SLIDE 20

Case Study #1: E-mail after registration/order

slide-21
SLIDE 21

Problems

 DNS/Networking issues  SMTP rules (external verification, spam filters)  How do we test this?  How do we guarantee that the message gets

through?

− What if it doesn't

 What if the DB rolls back?

slide-22
SLIDE 22

An alternative approach

slide-23
SLIDE 23

An alternative approach

slide-24
SLIDE 24

An alternative approach

slide-25
SLIDE 25

An alternative approach

slide-26
SLIDE 26

An alternative approach

slide-27
SLIDE 27

Why is this better?

 External system problems don't affect user

registration

 SMTP rules don't slow it down  If e-mail sending fails, we can easily re-send

later

slide-28
SLIDE 28

Key Difference:

The first part of the process succeeds without waiting for the second

  • but the second is guaranteed to

happen

slide-29
SLIDE 29

Transactional guarantee

slide-30
SLIDE 30

How do we test this?

 Mock queue/In memory implementation  Process registration and look at the queue

contents

 Easily unit testable  Focuses the test on what is really important

slide-31
SLIDE 31

Publish/Subscribe (Fire & Forget)

http://www.sxc.hu/photo/1084274

slide-32
SLIDE 32

Publish/Subscribe (Fire & Forget)

 When you need to talk to external systems but

don't really need to wait for them to finish

 Batch/overnight processing  Decouple processes so that they can be

performed asynchronously

 Effectively observer over messaging  Option to have multiple subscribers (observers)

slide-33
SLIDE 33

Case study #2: Credit card processing

slide-34
SLIDE 34

Case study #2: Credit card processing

slide-35
SLIDE 35

Case study #2: Credit card processing

slide-36
SLIDE 36

Case study #2: Credit card processing

slide-37
SLIDE 37

What could possibly go wrong?

 User closes the window mid-way  User clicks on refresh  Web call times out  CC channels too busy/RPC times out  Order processing fails after authorisation

slide-38
SLIDE 38

On top of that, we're wasting web/db resources!

slide-39
SLIDE 39

Alternative solution

slide-40
SLIDE 40

Alternative solution

slide-41
SLIDE 41

Alternative solution

slide-42
SLIDE 42

Alternative solution

slide-43
SLIDE 43

Alternative solution

slide-44
SLIDE 44

Alternative solution

slide-45
SLIDE 45

Alternative solution

slide-46
SLIDE 46

Alternative solution

slide-47
SLIDE 47

Alternative solution

slide-48
SLIDE 48

Alternative solution

slide-49
SLIDE 49

What's improved?

 Closing the window makes no difference  Refresh makes no difference  Web call will not time out  We can wait for CC channels  Web and DB resources used much better

slide-50
SLIDE 50

Some ways to improve this...

 Enqueue operation result, authorise order

asynchronously (increase resilience)

 Scale to more servers  Process cards using dedicated servers (VLAN)  Avoid polling, send a message to the client

slide-51
SLIDE 51

Some other situations where messaging might come in handy

 Distributing work across multiple machines  Performing a number of actions when

something happens (eg notify admin, notify customer)

 Pushing frequent updates to clients

slide-52
SLIDE 52

Tools

 ActiveMQ: http://activemq.apache.org/  NServiceBus: http://www.nservicebus.com/  AMQP: http://amqp.org

slide-53
SLIDE 53

Bridging the Communication Gap

 learn how to improve communication

between business people and software implementation teams

 find out how to build a shared and

consistent understanding of the domain in your team

 learn how to apply agile acceptance

testing to produce software genuinely fit for purpose

 discover how agile acceptance testing

affects your work whether you are a programmer, business analyst or a tester

 learn how to build in quality into software

projects from the start, rather than control it later

http://www.acceptancetesting.info