Hello Mike, thanks for responding. You understand my scenario exactly.
source. Each thread, has an event source, so worker threads and the service
"Mike Hayton [MS]" <mikehayt_@online.microsoft.com> wrote in message
news:JKTFYVikEHA.3852@cpmsftngxa10.phx.gbl...
> Im sorry, but Im not sure that I fully understand the structure of your
> program.
> Forgive me if I dont answer your question...
>
>
> I think you are saying that you have
>
> - 1 "service" timer
> - n "worker" timers
> When a timer elapses, the same method X() is called that contains a call
to
> raise a EIF event. (say using ErrorEvent.Raise("error message");)
> When the "service" timer elapses, it creates a RequestTrace (using a
static
> RequestEventSource of name "service") and calls into X()
> When a "worker" timer elapses, it creates a RequestTrace (using a static
> RequestEventSource of name "worker") and calls into X()
>
> The question is what happens when the different threads raise the error
> event?
>
> Events are raised through an EventSource. In the case above the
> ErrorEvent.Raise() method is actually raising the event through the
> standard Application event source.
> i.e. its equivalent to the code of
> ErrorEvent e = new ErrorEvent()
> e.Message = "error message";
> EventSource.Application.Raise(e);
>
> Now when an event is raised, EIF checks to see if there is an active
> RequestEventSource - if so, the event is also raised down this
> RequestEventSource (it all happens under the covers in EIF). It should be
> noted that the active RequestEventSource is stored on the thread local
> storage (called CallContext in .NET) and there can only be one active
> RequestEventSource at one time.
>
> EventSource instances are thread safe, so multiple threads can raise
events
> through them.
> EventSinks (if youre writeing your own event sink) should be thread safe
as
> well in the Write() method - i.e. multiple threads might be executing in
> the same Write() method.
>
> In the case above,
> the "service" thread would raise an event down the EventSource named
> "Application" and the RequestEventSource named "service".
> the "worker" thread would raise an event down the EventSource named
> "Application" and the RequestEventSource named "worker".
>
> In the EIF.config file you can route the event to different/same event
> sinks for each of the three event sources (namely "Application",
"service",
> & "worker").
>
> I hope this helps.
>
> Mike
>
>
>
>
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Use of included script samples are subject to the terms specified at
>
http://www.microsoft.com/info/cpyright.htm > --------------------
> | I have a service timer, and one or more worker timers running in a
> service.
> | The worker timers get created when the service timer elapses, and
executes
> | code to build and initialize the worker timer. When worker timers are
> | created, they are initialized with an appropriate event handler and they
> are
> | started.
> |
> | There is a point in the when the service timer, and a worker timer could
> | execute the same method (although, not at the same time).
> |
> | I have set up two request event sources, and two RequestTrace objects.
> When
> | the code is executing service timer specific events, I am manually
raising
> | events to the appropriate request event source. However, in the method
> that
> | could be executed by the service timer, and the worker timer, I am not
> | specifying the event source for the trace message. There could be two
> | active event sources at the time that this code executes.
> |
> | So the question is, where will the EIF publish the implicitly raised
> message
> | event in the event that there are two or more event sources available?
> |
> |
> |
>