Wrox Programmer Forums
|
BOOK: Patterns, Principles and Practices of Domain-Driven Design
This is the forum to discuss the Wrox book Patterns, Principles and Practices of Domain-Driven Design by Scott Millett; ISBN: 978-1-118-71470-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Patterns, Principles and Practices of Domain-Driven Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2015, 09:46 AM
Registered User
 
Join Date: May 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Messaging Workflow Question

great job really digging the book thus far!

quick questions since i am new to the messaging scene and still analyzing everything i am reading.

when looking at the source code for the e-commerce site when placing an order and contacting the payment provider, it seems to me the customer could be billed more than once if for example after contacting the payment provider (which charges the customer) the last step in the business use case calls Bus.Send and the local MSMQ (assuming transport) is for some reason down the message would be placed back on the queue and retried.

when designing workflows like this do we always assume the local queue service is up and running?
 
Old May 12th, 2015, 08:34 AM
Wrox Author
 
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts
Default

Hi,

I'm delighted to hear you are finding the book useful. And I'm delighted that you asked this question, because it shows you understand the important details

Firstly, you are correct. We do assume that some type of local storage is always running. If the message bus is able to take a message from a queue, then the assumption is that it is in a healthy state to reliably process that message.

This assumption may not always hold true, though. And unfortunately, there's not a lot you can really do about it. You just have to trust that your messaging infrastructure will fail gracefully. When you use a robust, proven technology like NServiceBus, the chances are that it will.

Ultimately, though, there is always a tiny chance the customer will be charged twice. For example, if the server shuts down in-between the time the card is charged and the transaction completes (or acknowledgement is sent), the message will be retried again later.

What we've shown in the book is that by wrapping each non-idempotent action with a message, you reduce the chance that the customer will be charged twice as much as possible. This also relates to the local storage used by the messaging infrastructure; it probably could go down and cause the payment to be charged twice, but it is very unlikely.

I hope this helps. And please feel free to post more questions. If you want an in-depth chat on skype just let me know

Nick

Last edited by nick_t; May 12th, 2015 at 08:39 AM..
 
Old May 12th, 2015, 08:45 AM
Registered User
 
Join Date: May 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks nick that makes perfect sense!





Similar Threads
Thread Thread Starter Forum Replies Last Post
charpter 16 KB Article Review & Approve workflow can't be found when create workflow basten BOOK: Professional Alfresco: Practical Solutions for Enterprise Content Management 0 July 14th, 2011 10:32 PM
Duplex Messaging iamdony Windows Communication Foundation 0 October 28th, 2009 09:33 PM
Workflow Question realkewl BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 May 15th, 2009 09:24 AM
Workflow Validate Method Question Corsair BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 April 21st, 2009 12:31 PM
instant messaging with System.Messaging connect2sandep General .NET 35 March 1st, 2006 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.