Class Emitter<T>
Represents a stream of messages. An emitter is similar to a .Net Event, in that it is used to propagate information to a set of subscriber that is only known at runtime. While a subscriber to an event is of type delegate, a subscriber to an emitter is of type Receiver<T> (which wraps a delegate).
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public sealed class Emitter<T> : object, IEmitter, IProducer<T>
Type Parameters
Name | Description |
---|---|
T | The type of messages in the stream. |
Properties
View SourceHasSubscribers
Gets a value indicating whether this emitter has subscribers.
Declaration
public bool HasSubscribers { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Id
Gets emitter ID.
Declaration
public int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
LastEnvelope
Gets the envelope of the last message posted on this emitter.
Declaration
public Envelope LastEnvelope { get; }
Property Value
Type | Description |
---|---|
Envelope |
Name
Gets emitter name.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Owner
Gets emitter owner object.
Declaration
public object Owner { get; }
Property Value
Type | Description |
---|---|
Object |
Pipeline
Gets pipeline to which emitter belongs.
Declaration
public Pipeline Pipeline { get; }
Property Value
Type | Description |
---|---|
Pipeline |
Type
Gets emitter type.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
View SourceClose(DateTime)
Close emitter, causing all receivers to be unsubscribed.
Declaration
public void Close(DateTime originatingTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | originatingTime | The originating time at which the emitter closes. |
DebugView(String)
Enables debug visualization for this stream.
Declaration
public string DebugView(string debugName = null)
Parameters
Type | Name | Description |
---|---|---|
String | debugName | An optional name to use in the visualization window. |
Returns
Type | Description |
---|---|
String | The debug name of the stream, either as provided or the generated one if one was not specified. |
EnablePerfCounters(String, IPerfCounters<EmitterCounters>)
Enable performance counters.
Declaration
public void EnablePerfCounters(string name, IPerfCounters<EmitterCounters> perf)
Parameters
Type | Name | Description |
---|---|---|
String | name | Instance name. |
IPerfCounters<EmitterCounters> | perf | Performance counters implementation (platform specific). |
Post(T, DateTime)
Synchronously calls all subscribers. When the call returns, the message is assumed to be unchanged and reusable (that is, no downstream component is referencing it or any of its parts).
Declaration
public void Post(T message, DateTime originatingTime)
Parameters
Type | Name | Description |
---|---|---|
T | message | The message to post. |
DateTime | originatingTime | The time of the real-world event that led to the creation of this message. |
Explicit Interface Implementations
View SourceIProducer<T>.Out
Gets the stream to write messages to.
Declaration
Emitter<T> IProducer<T>.Out { get; }
Returns
Type | Description |
---|---|
Emitter<T> |