﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Greg commented on Refactor This: Answers</title><description>Cross cutting concerns so, use AOP? 
</description><link>http://ayende.com/4451/refactor-this-answers#comment9</link><guid>http://ayende.com/4451/refactor-this-answers#comment9</guid><pubDate>Tue, 06 Apr 2010 12:50:41 GMT</pubDate></item><item><title>Corey commented on Refactor This: Answers</title><description>I'll probably toy with this idea on my own and if you're up for taking a look when it's "ready" to poke holes in. I may need some ideas for the Windsor magic to take it the long haul, but I should be able to prove the concept without it for now.
</description><link>http://ayende.com/4451/refactor-this-answers#comment8</link><guid>http://ayende.com/4451/refactor-this-answers#comment8</guid><pubDate>Mon, 05 Apr 2010 23:07:40 GMT</pubDate></item><item><title>Corey commented on Refactor This: Answers</title><description>Even if you were to ignore my comments above.  You could achieve the equivalent to what exists now in the RhinoQueueTransport (or at least before you changed things) with the below chain named for comparison. The only thing I see being lost is the logging with very specific messages in each of the catch blocks. Did I miss something?
  
  
Policies
  
.WrapBehaviorChainsWith&lt;FireMessageReceivedBehavior&gt;()
  
.WrapBehaviorChainsWith&lt;TransactionBehavior&gt;()
  
.WrapBehaviorChainsWith&lt;FireMessageCompletedBehavior&gt;()
  
.WrapBehaviorChainsWith&lt;FireMessageProcessingFailure&gt;(); 
</description><link>http://ayende.com/4451/refactor-this-answers#comment7</link><guid>http://ayende.com/4451/refactor-this-answers#comment7</guid><pubDate>Mon, 05 Apr 2010 18:18:54 GMT</pubDate></item><item><title>Bryan commented on Refactor This: Answers</title><description>I'm with Colin.  Corey's refactoring is a major step in the right direction.  If you want more, we need use cases, unit tests, something, anything more to put the original code into context.
</description><link>http://ayende.com/4451/refactor-this-answers#comment6</link><guid>http://ayende.com/4451/refactor-this-answers#comment6</guid><pubDate>Mon, 05 Apr 2010 17:11:09 GMT</pubDate></item><item><title>Colin commented on Refactor This: Answers</title><description>Maybe it's not that people didn't read the code and more that there weren't any unit tests to verify behavior.  ;)
  
  
Also, I have a hunch that much of the complexity found in that method was the consequence of decisions made in other parts of the code.  I agree that none of the posted refactorings felt quite right, but without more context it's hard to come up with a good solution.
</description><link>http://ayende.com/4451/refactor-this-answers#comment5</link><guid>http://ayende.com/4451/refactor-this-answers#comment5</guid><pubDate>Mon, 05 Apr 2010 16:45:29 GMT</pubDate></item><item><title>Ayende Rahien commented on Refactor This: Answers</title><description>Corey,
  
Error handling is not something that the IMessageModule author should care about. That is not something that they need to, because the infrastructure takes care of this.
</description><link>http://ayende.com/4451/refactor-this-answers#comment4</link><guid>http://ayende.com/4451/refactor-this-answers#comment4</guid><pubDate>Mon, 05 Apr 2010 15:53:56 GMT</pubDate></item><item><title>Corey commented on Refactor This: Answers</title><description>The end user writing behaviors outside the core provided ones. In other words a person who might write a message module currently for whatever reason, providing an NHibernate session, auditing, authorization, etc. Ugh I forgot generics were stripped out of comments.
  
I meant BaseBehavior&lt;HandleErrorAndIgnore&gt;
</description><link>http://ayende.com/4451/refactor-this-answers#comment3</link><guid>http://ayende.com/4451/refactor-this-answers#comment3</guid><pubDate>Mon, 05 Apr 2010 15:51:25 GMT</pubDate></item><item><title>Ayende Rahien commented on Refactor This: Answers</title><description>Corey,
  
What user?
  
There isn't a user here, this is infrastructure code that the user never sees
</description><link>http://ayende.com/4451/refactor-this-answers#comment2</link><guid>http://ayende.com/4451/refactor-this-answers#comment2</guid><pubDate>Mon, 05 Apr 2010 15:42:54 GMT</pubDate></item><item><title>Corey commented on Refactor This: Answers</title><description>As it currently exists an exception can be thrown by.
  
  
1. Processing message in consumer throws.
  
2. An error in MessageArrived, MessageCompleted, BeforeMessageCompleted, MessageProcessingFailure
  
3. Commiting the transaction.
  
4. Deserializing message
  
  
The ways that exceptions are handled differently.
  
  
1. Transaction is rolled back with an error action for incrementing failure and message put back into queue.
  
2. Error is logged and ignored.
  
  
I may be simplifying something in my head, but I'm pretty sure those can all be accounted for. I might even question the need of some of the events at all if this were the approach taken. Additionally the behaviors could be given the option on how to handle errors if they each need their own error handling. I don't think error handling awareness is all that much to ask of the end user if you're adding behaviors. You could also get rid of the generic catch all ErrorBehavior and provide something more explicit in the BaseBehavior
&lt;handleerrorandignore&gt;</description><link>http://ayende.com/4451/refactor-this-answers#comment1</link><guid>http://ayende.com/4451/refactor-this-answers#comment1</guid><pubDate>Mon, 05 Apr 2010 15:35:13 GMT</pubDate></item></channel></rss>