I’m having some trouble registering MiniProfiler results for Redis MQ handlers:
http://stackoverflow.com/questions/21219365/servicestack-message-queue-handling-and-profiler
I’d be glad if anyone could shed some light on this issue
Nicklas Laine Overgaard:
Well everything is hosted within an ASP.NET Application - I’m starting the AppHost in Global.asax. I just found it more convenient to have all my “before request” handling in the ServiceRunner.
But I’m guessing that the execution of the MQ handlers are not done within the ASP.NET context?
There’s no HttpContext.Current when invoked outside of the context of an ASP.NET request, i.e. inside a RedisMQ Host.
There’s a chance you could simulate an ASP.NET context by setting HttpContext.Current = with a Mock HttpContext inside custom RedisMqServer.RequestFilter/ResponseFilter handlers. I’ve had to do that once to trick Ninject’s IOC RequestScope to work, but not sure if it will work completely with MiniProfiler. But it will at least get past the first HttpContext.Current == null short-circuit check.
Nicklas Laine Overgaard:
Okay, thanks for clarifying… I’ll just have to live without the profiling of the MQ handlers then.
Nicklas Laine Overgaard:
Question: If the MQ handlers are executed in a self-contained app / ASP.net host, wouldn’t it be possible to create a new ProfilerProvider which uses Thread-local storage, since the Redis MQ handlers are executed on individual threads (and only handle one message at a time)?
I was planning on trying to implement it my self, just don’t want to waste time on it if you can tell me that it wont work Thanks in advance.
Yep should be possible.