Thanks for the replies.
A dependency on a transient ISession doesn't really work because you'd
really want classes further down the call stack to be using the same
session as the caller.
> ... then think about how
> you might add some hooks to the MT pipeline
I'm not familiar with the internals of MT, where would one start
looking to plug into the pipeline?
Thanks again.
On Jul 5, 7:39 pm, Dru Sellers <
d...@drusellers.com> wrote:
> by default we don't ship with anything like this.we do create a new consumer
> / message much like controllers in MVC frameworks tend to be one controller
> per HTTP request. in the web frameworks you would plug into the
> Begin/EndRequest and set you session up there. if masstransit exposed this
> kind of a concept then conceptually you could do the same thing as well.
> usually the goal here is to have a session created and then automatically
> closed (flushed, transacted) for you. you could acheive the same thing by
> having your IoC framework automatically wrap the consumer in a decorator
> that would manage this for you. but that's not quite as simple as a
> lifestyle. taking a dependency on the ISession would work since you would
> have one / consumer but that might expose ISession more than you want.
> MassTransit has a lower level concept of message filters that might fit your
> needs but I am not sure that it well.
>
> Right now I would suggest the ISession dependency and then think about how
> you might add some hooks to the MT pipeline to do what you suggest via a
> lifecycle. the lifecycle class would have to know about MT and the IoC
> framework but it should be doable (it will just require some work).
>
> hope this helped,
> -d
>
> On Sun, Jul 5, 2009 at 10:03 AM, Chris Patterson
> <
chrisfromtu...@gmail.com>wrote:
>
>
>
> > Could you just take a dependency on ISession in your class that consumes
> > the message and and set the lifestyle to Transient? A new consumer class
> > instance will be pulled from the container for each message received. This
> > is how we've done it before.
>
> > On Jul 2, 2009, at 3:49 AM, oll wrote:
>
> > Is there a Windsor LifestyleType that would allow a new session to be
> > created per Consume call?
>
> > We have a session manager implementation used throughout our system
> > that will open a new session as specified by a LifestyleType (i.e.
> > Transient, PerThread, PerWebRequest). I would like to open a new
> > session whenever a message is consumed (i.e. Consume
> > (UserRegistrationRequest message){}, Consume(PasswordChanged message)
> > {}). Is this possible?
>
> > Thanks
>
> > Chris Patterson
> >
chrisfromtu...@gmail.com