\r\n

51Degrees Pipeline .NET  4.1Newer Version 4.4

51Degrees Pipeline for .NET

FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase Class Reference abstract

Detailed Description

Abstract base class for ShareUsage elements.

Contains common functionality such as filtering the evidence and building the XML records.

Inheritance diagram for FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase:

[legend]

Collaboration diagram for FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase:

[legend]

Classes

class  ShareUsageData
Inner class that is used to store details of data in memory prior to it being sent to 51Degrees. More...

Public Member Functions

override void  AddPipeline (IPipeline pipeline)
Add More...
string  EncodeInvalidXMLChars (string text)
encodes any unusual characters into their hex representation More...

Public Member Functions inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IElementData, IElementPropertyMetaData >

 FlowElementBase (ILogger< FlowElementBase< T, TMeta >> logger)
Constructor More...
 FlowElementBase (ILogger< FlowElementBase< T, TMeta >> logger, Func< IFlowData, FlowElementBase< T, TMeta >, T > elementDataFactory)
Constructor More...
virtual void  Process (IFlowData data)
Process the given IFlowData with this FlowElement. More...
void  Dispose ()
Dispose More...

Protected Member Functions

 ShareUsageBase (ILogger< ShareUsageBase > logger, HttpClient httpClient, double sharePercentage, int minimumEntriesPerMessage, int maximumQueueSize, int addTimeout, int takeTimeout, int repeatEvidenceIntervalMinutes, bool trackSession, string shareUsageUrl, List< string > blockedHttpHeaders, List< string > includedQueryStringParameters, List< KeyValuePair< string, string >> ignoreDataEvidenceFilter, string aspSessionCookieName=Engines.Constants.DEFAULT_ASP_COOKIE_NAME)
Constructor More...
 ShareUsageBase (ILogger< ShareUsageBase > logger, HttpClient httpClient, double sharePercentage, int minimumEntriesPerMessage, int maximumQueueSize, int addTimeout, int takeTimeout, int repeatEvidenceIntervalMinutes, bool trackSession, string shareUsageUrl, List< string > blockedHttpHeaders, List< string > includedQueryStringParameters, List< KeyValuePair< string, string >> ignoreDataEvidenceFilter, string aspSessionCookieName, ITracker tracker)
Constructor More...
override void  ProcessInternal (IFlowData data)
Process the data More...
override void  ManagedResourcesCleanup ()
Send any data which has built up locally and not yet been sent to the remote service. More...
override void  UnmanagedResourcesCleanup ()
Clean up any unmanaged resources. More...
void  TrySendData ()
Attempt to send the data to the remote service. More...
abstract void  BuildAndSendXml ()
virtual void  WriteData (XmlWriter writer, ShareUsageData data)
Virtual method to be overridden in extending usage share elements. More...
void  WriteDeviceData (XmlWriter writer, ShareUsageData data)
Write the specified device data using the specified writer. More...
virtual void  WritePipelineInfo (XmlWriter writer)
Virtual method to write details about the pipeline. More...

Protected Member Functions inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IElementData, IElementPropertyMetaData >

abstract void  ProcessInternal (IFlowData data)
Abstract method called by Process(IFlowData). More...
virtual T  CreateElementData (IFlowData flowData)
Method used to create element data instances that are populated by this flow element More...
virtual void  Dispose (bool disposing)
Dispose of any resources. More...

Protected Attributes

HttpClient  _httpClient
The HttpClient to use when sending the data. More...
BlockingCollection< ShareUsageData >  _evidenceCollection
Queue used to store entries in memory prior to them being sent to 51Degrees. More...
int  _takeTimeout
Timeout to use when taking from the queue. More...
int  _minEntriesPerMessage = Constants.SHARE_USAGE_DEFAULT_MIN_ENTRIES_PER_MESSAGE
The minimum number of request entries per message sent to 51Degrees. More...
string  _shareUsageUrl = ""
XmlWriterSettings  _writerSettings

Protected Attributes inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IElementData, IElementPropertyMetaData >

ILogger< FlowElementBase< T, TMeta > >  _logger
Logger. More...

Properties

override string  ElementDataKey [get]
override IEvidenceKeyFilter  EvidenceKeyFilter [get]
Get the evidence key filter for this element. More...
override IList< IElementPropertyMetaData >  Properties [get]
internal bool  IsCanceled = false [get, set]
Indicates whether share usage has been canceled as a result of an error. More...

Properties inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IElementData, IElementPropertyMetaData >

IReadOnlyList< IPipeline >  Pipelines [get]
Get a read only list of the pipelines that this element has been added to. More...
abstract string  ElementDataKey [get]
The string name of the key used to access the data populated by this element in the IFlowData. More...
abstract IEvidenceKeyFilter  EvidenceKeyFilter [get]
A list of all the evidence keys that this Flow Element can make use of. More...
abstract IList< TMeta >  Properties [get]
Details of the properties that this engine can populate More...
virtual bool  Asynchronous [get]
True if the element can be run totally asynchronously, false otherwise. More...
virtual bool  IsConcurrent [get]
True if the element starts multiple threads. More...
bool  IsDisposed [get]
True if the element has been disposed More...
ITypedKey< T >  ElementDataKeyTyped [get]
Get the key used to access the data populated by this element in the IFlowData. More...

Constructor & Destructor Documentation

◆ ShareUsageBase() [1/2]

FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.ShareUsageBase ( ILogger< ShareUsageBase >   logger,
HttpClient   httpClient,
double   sharePercentage,
int   minimumEntriesPerMessage,
int   maximumQueueSize,
int   addTimeout,
int   takeTimeout,
int   repeatEvidenceIntervalMinutes,
bool   trackSession,
string   shareUsageUrl,
List< string >   blockedHttpHeaders,
List< string >   includedQueryStringParameters,
List< KeyValuePair< string, string >>   ignoreDataEvidenceFilter,
string   aspSessionCookieName = Engines.Constants.DEFAULT_ASP_COOKIE_NAME  
)
protected

Constructor

Parameters
logger - The logger to use.
httpClient - The HttpClient to use when sending request data.
sharePercentage - The approximate proportion of requests to share. 1 = 100%, 0.5 = 50%, etc.
minimumEntriesPerMessage - The minimum number of request entries per message sent to 51Degrees.
maximumQueueSize - The maximum number of items to hold in the queue at one time. This must be larger than minimum entries.
addTimeout - The timeout in milliseconds to allow when attempting to add an item to the queue. If this timeout is exceeded then usage sharing will be disabled.
takeTimeout - The timeout in milliseconds to allow when attempting to take an item to the queue.
repeatEvidenceIntervalMinutes - The interval (in minutes) which is used to decide if repeat evidence is old enough to consider a new session.
trackSession - Set if the tracker should consider sessions in share usage.
shareUsageUrl - The URL to send data to
blockedHttpHeaders - A list of the names of the HTTP headers that share usage should not send to 51Degrees.
includedQueryStringParameters - A list of the names of query string parameters that share usage should send to 51Degrees.
ignoreDataEvidenceFilter -
aspSessionCookieName - The name of the cookie that contains the asp.net session id.

◆ ShareUsageBase() [2/2]

FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.ShareUsageBase ( ILogger< ShareUsageBase >   logger,
HttpClient   httpClient,
double   sharePercentage,
int   minimumEntriesPerMessage,
int   maximumQueueSize,
int   addTimeout,
int   takeTimeout,
int   repeatEvidenceIntervalMinutes,
bool   trackSession,
string   shareUsageUrl,
List< string >   blockedHttpHeaders,
List< string >   includedQueryStringParameters,
List< KeyValuePair< string, string >>   ignoreDataEvidenceFilter,
string   aspSessionCookieName,
ITracker   tracker  
)
protected

Constructor

Parameters
logger - The logger to use.
httpClient - HttpClient to use when sending request data.
sharePercentage - The approximate proportion of requests to share. 1 = 100%, 0.5 = 50%, etc.
minimumEntriesPerMessage - The minimum number of request entries per message sent to 51Degrees.
maximumQueueSize - The maximum number of items to hold in the queue at one time. This must be larger than minimum entries.
addTimeout - The timeout in milliseconds to allow when attempting to add an item to the queue. If this timeout is exceeded then usage sharing will be disabled.
takeTimeout - The timeout in milliseconds to allow when attempting to take an item to the queue.
repeatEvidenceIntervalMinutes - The interval (in minutes) which is used to decide if repeat evidence is old enough to consider a new session.
trackSession - Set if the tracker should consider sessions in share usage.
shareUsageUrl - The URL to send data to
blockedHttpHeaders - A list of the names of the HTTP headers that share usage should not send to 51Degrees.
includedQueryStringParameters - A list of the names of query string parameters that share usage should send to 51Degrees.
ignoreDataEvidenceFilter -
aspSessionCookieName - The name of the cookie that contains the asp.net session id.
tracker - The ITracker to use to determine if a given IFlowData instance should be shared or not.

Member Function Documentation

◆ AddPipeline()

override void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.AddPipeline ( IPipeline   pipeline )
virtual

◆ BuildAndSendXml()

abstract void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.BuildAndSendXml ( )
protected pure virtual

◆ EncodeInvalidXMLChars()

string FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.EncodeInvalidXMLChars ( string   text )

encodes any unusual characters into their hex representation

◆ ManagedResourcesCleanup()

override void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.ManagedResourcesCleanup ( )
protected virtual

Send any data which has built up locally and not yet been sent to the remote service.

Implements FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IElementData, IElementPropertyMetaData >.

◆ ProcessInternal()

override void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.ProcessInternal ( IFlowData   data )
protected

Process the data

Parameters
data - The IFlowData instance that provides the evidence

◆ TrySendData()

void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.TrySendData ( )
protected

Attempt to send the data to the remote service.

This only happens if there is not a task already running.

If any error occurs while sending the data, then usage sharing is stopped.

Returns

◆ UnmanagedResourcesCleanup()

override void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.UnmanagedResourcesCleanup ( )
protected virtual

◆ WriteData()

virtual void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.WriteData ( XmlWriter   writer,
ShareUsageData   data  
)
protected virtual

Virtual method to be overridden in extending usage share elements.

Write the specified data using the specified writer.

Parameters
writer - The XmlWriter to use.
data - The ShareUsageData to write.

◆ WriteDeviceData()

void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.WriteDeviceData ( XmlWriter   writer,
ShareUsageData   data  
)
protected

Write the specified device data using the specified writer.

Parameters
writer - The XmlWriter to use.
data - The ShareUsageData to write.

◆ WritePipelineInfo()

virtual void FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.WritePipelineInfo ( XmlWriter   writer )
protected virtual

Virtual method to write details about the pipeline.

Member Data Documentation

◆ _evidenceCollection

BlockingCollection<ShareUsageData> FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase._evidenceCollection
protected

Queue used to store entries in memory prior to them being sent to 51Degrees.

◆ _httpClient

HttpClient FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase._httpClient
protected

The HttpClient to use when sending the data.

◆ _minEntriesPerMessage

int FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase._minEntriesPerMessage = Constants.SHARE_USAGE_DEFAULT_MIN_ENTRIES_PER_MESSAGE
protected

The minimum number of request entries per message sent to 51Degrees.

◆ _takeTimeout

int FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase._takeTimeout
protected

Timeout to use when taking from the queue.

◆ _writerSettings

XmlWriterSettings FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase._writerSettings
protected
Initial value:
= new XmlWriterSettings()
{
ConformanceLevel = ConformanceLevel.Document,
Encoding = Encoding.UTF8,
CheckCharacters = true,
NewLineHandling = NewLineHandling.None,
CloseOutput = true,
}

Property Documentation

◆ EvidenceKeyFilter

override IEvidenceKeyFilter FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.EvidenceKeyFilter
get

Get the evidence key filter for this element.

◆ IsCanceled

internal bool FiftyOne.Pipeline.Engines.FiftyOne.FlowElements.ShareUsageBase.IsCanceled = false
get set protected

Indicates whether share usage has been canceled as a result of an error.

On This Page