Thanks Greg, this could be very interesting. Sorry for my simple simple reply.. Starting from what you said, I can dispatch a message, that would be handled in a specific thread, and there the session would be associated to the executing thread?! I Understood what you said? pleas could be more explicative? Thanks in advance Your reply is the first really serious reply on that problem/question Cheers
On Jan 7, 5:30 pm, Greg Young <[email protected]> wrote: > If its a state machine/messaging server the easy answer would be to > commit and dispatch the new message (which would then get picked up) > as opposed to starting a new thread. This style is a well known > pattern in messaging state machines. > > > > > > > > > > On Fri, Jan 7, 2011 at 10:02 AM, hoghweed <[email protected]> wrote: > > Thanks, I know what you said but It's not the kind of help I was > > looking for! > > Regards. > > > On Jan 7, 11:54 am, FaticaLabs <[email protected]> wrote: > >> Hi hoghweed, > >> AFAIK a session should not be used across threads, since session is > >> not thread safe. > >> Felix. > > >> On Jan 7, 1:46 am, hoghweed <[email protected]> wrote: > > >> > I'm building a sort of a state-machine server based on xml and json as > >> > description, a kind of "workflow server" (even if i hate workflows..) > >> > I'm using NH as persistence. Thisea "server" is hosted in a Windows > >> > Service and makes usage of multithreading. > > >> > The server receives notifications and messages, when a message arrives > >> > a NH session is spawned and lives through the life of a message, till > >> > here all could be fine. > >> > There are some messages which creates a new thread to perform some > >> > actions, and I need that threads using the same Session created in the > >> > message "context". > > >> > I made a big error, as Ayende say everytime, I used a framework over > >> > NH, the framework is NCommon (https://github.com/riteshrao/ncommon) > >> > which use a kind of SessionScope which makes a kind of "context", so > >> > nested SessionScopes creates unit-of-work inside the outer, the first > >> > one created. > > >> > I know NH use the ability to get a SessionContext where it's possible > >> > to bind a session in a particular context, so it's possible to get the > >> > current session from the sessionfactory. > > >> > How to make possible to use the message-context-created session to > >> > threads created in this particular message-context? could a good idea > >> > to create a custom sessioncontext class, and associate a session to a > >> > kind of a message-id? if so, how, and what's the best way to associate > >> > that threads to that message-id? > >> > Thanks in advance > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" 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 > > athttp://groups.google.com/group/nhusers?hl=en. > > -- > Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer > de votre attention -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
