@Mike: I was thinking the Message Module or Interceptor would be the
'cross cutting' part.
@Ayende: I know an exception would cause all messages to fail. I was
thinking of a 'silent' fail. With an interceptor it would could look
like
if(user is authorized) {invocation.Proceed();}
else {process unauthorized request}
This way other messages in the batch would complete.
If a message module is called per message who does this work with
opening NH Sessions? up until this spike I have always passed 1
message at a time.  I got the idea to pass multiple messages with your
post on efficiently querying (http://ayende.com/Blog/archive/
2010/02/15/challenges-where-is-the-optimization.aspx) if a message
module is used to manage the scope of a NH session would a session be
opened for each message?
message arrived()
{
   CallContext.Bind(sessionFactory.OpenSession());
}
message processing completed()
{
   CallContext.Unbind(sessionFactory).Dispose();
}

checking for a bind would solve this
message arrived()
{
   if(CallContext.HasBind(sessionFactory)) return;
   CallContext.Bind(sessionFactory.OpenSession());
}

I have been assuming these handlers are called once per batch. not
once per message.
On Mar 22, 3:35 am, Ayende Rahien <[email protected]> wrote:
> Jason,
> If you have a message batch, all the message MUST pass/fail in a single
> transaction.
> As for validating all the messages in the batch, the message module will be
> call once per message.
> You can access the entire batch by calling AllMessages.
>
> On Sat, Mar 20, 2010 at 5:00 PM, Jason Meckley <[email protected]>wrote:
>
> > I want to spike validation and authorization of RSB message
> > processing. I will be using Castle.Validator and Rhino.Security.
> > Since each command will have validation and authorization I would like
> > to put the checks outside of the consumer.
>
> > I have used IMessageModule before to manage NH Session but that is
> > consumer independent so I never had to think about what information
> > the message(s) contains. For this spike I need access to the message
> > to validate and authorize. I'm not sure if this logic should be
> > implemented by an interceptor or message module though.
>
> > an Interceptor will require me to validate the interceptor is
> > associated with an IMessageConsumer. Easy enough with IOnBehalfAware.
> > However I could skip this check with a message module. A message
> > module can process multiple messages in a single transaction and I may
> > want 1 action to fail while another succeeds. I don't think I can do
> > that with a message module, at that point processing messages is all
> > or nothing. with an interceptor i could fail specific consumers and
> > run another operation (like process failed message, or process
> > unauthorized request.)
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Rhino Tools Dev" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<rhino-tools-dev%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhino-tools-dev?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to