Are NServiceBus handler's members safe for storing message related (and not related) data? -
are handlers reused proceed message?
public abstract class somehandler : ihandlemessages<myevent> { public ibus bus { get; set; } public string message { get; set; } public void handle(t message) { message = "test"; someinstancemethod(); } public void someinstancemethod() { if (message = ...) // can use message here? return; } }
by default, message handlers configured componentcallmodelenum.singlecall, means each call on component performed on new instance.
so, 2 messages processed different instances of class , cannot share state.
however, have here setting class property , calling method in class retrieves property. work fine. however, in opinion, kind of confusing, , if you're after, you're better off passing values method parameter.
Comments
Post a Comment