Class Receiver<T>
A receiver that calls the wrapped delegate to deliver messages by reference (hence, unsafe). The wrapped delegate must not modify or store the message or any part of the message.
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public sealed class Receiver<T> : object, IReceiver, IConsumer<T>
Type Parameters
Name | Description |
---|---|
T | The type of messages that can be received. |
Remarks
The Receiver class uses the Scheduler to deliver messages. However, the workitem unit scheduled by the Receiver is the whole receiver queue, not a single message. In other words, the Receiver simply schedules itself, and there will be only one workitem present in the scheduler queue for any given Receiver. This guarantees message delivery order regardless of the kind of scheduling used by the scheduler.
Properties
View SourceDeliveryPolicy
Gets the delivery policy for this receiver.
Declaration
public DeliveryPolicy<T> DeliveryPolicy { get; }
Property Value
Type | Description |
---|---|
DeliveryPolicy<T> |
Id
Gets receiver ID.
Declaration
public int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
LastEnvelope
Gets the envelope of the last message delivered.
Declaration
public Envelope LastEnvelope { get; }
Property Value
Type | Description |
---|---|
Envelope |
Name
Gets receiver name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String |
Owner
Gets receiver owner object.
Declaration
public object Owner { get; }
Property Value
Type | Description |
---|---|
Object |
Recycler
Gets receiver message recycler.
Declaration
public IRecyclingPool<T> Recycler { get; }
Property Value
Type | Description |
---|---|
IRecyclingPool<T> |
Type
Gets receiver type.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
View SourceDispose()
Declaration
public void Dispose()
EnablePerfCounters(String, IPerfCounters<ReceiverCounters>)
Enable performance counters.
Declaration
public void EnablePerfCounters(string name, IPerfCounters<ReceiverCounters> perf)
Parameters
Type | Name | Description |
---|---|---|
String | name | Instance name. |
IPerfCounters<ReceiverCounters> | perf | Performance counters implementation (platform specific). |
Recycle(T)
Recycle item.
Declaration
public void Recycle(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | Item to recycle. |
Recycle(Message<T>)
Recycle message.
Declaration
public void Recycle(Message<T> freeMessage)
Parameters
Type | Name | Description |
---|---|---|
Message<T> | freeMessage | Message to recycle. |
Events
View SourceUnsubscribed
Event invoked after this receiver is unsubscribed from its source emitter.
Declaration
public event Receiver<T>.UnsubscribedHandler Unsubscribed
Event Type
Type | Description |
---|---|
Receiver.UnsubscribedHandler<> |
Explicit Interface Implementations
View SourceIConsumer<T>.In
Gets the input we receive messages on.
Declaration
Receiver<T> IConsumer<T>.In { get; }
Returns
Type | Description |
---|---|
Receiver<T> |
IReceiver.Source
Gets receiver source emitter.
Declaration
IEmitter IReceiver.Source { get; }
Returns
Type | Description |
---|---|
IEmitter |