/// <summary> /// Initializes a new instance of the <see cref="InternalSerializerDecorator" /> class. /// </summary> /// <param name="metrics">The metrics factory.</param> /// <param name="handler">The handler.</param> /// <param name="connectionInformation">The connection information.</param> public LinqCompilerDecorator(IMetrics metrics, ILinqCompiler handler, IConnectionInformation connectionInformation) { var name = "LinqCompiler"; _compileActionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileActionTimer", Units.Calls); _handler = handler; }
/// <summary> /// Initializes a new instance of the <see cref="InternalSerializerDecorator" /> class. /// </summary> /// <param name="metrics">The metrics factory.</param> /// <param name="handler">The handler.</param> /// <param name="connectionInformation">The connection information.</param> public LinqCompilerDecorator(IMetrics metrics, ILinqCompiler handler, IConnectionInformation connectionInformation) { var name = handler.GetType().Name; _compileActionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileActionTimer", Units.Calls); _compileFunctionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileFunctionTimer", Units.Calls); _handler = handler; }
/// <summary> /// Initializes a new instance of the <see cref="MessageMethodHandling" /> class. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="linqCompiler">The method compiler.</param> /// <param name="compositeSerialization">The composite serialization.</param> public MessageMethodHandling(IExpressionSerializer serializer, ILinqCompiler linqCompiler, ICompositeSerialization compositeSerialization) { Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => linqCompiler, linqCompiler); Guard.NotNull(() => compositeSerialization, compositeSerialization); _serializer = serializer; _linqCompiler = linqCompiler; _compositeSerialization = compositeSerialization; }
/// <summary>Initializes a new instance of the <see cref="LinqCompileCacheDecorator"/> class.</summary> /// <param name="handler">The handler.</param> /// <param name="cacheProvider"></param> /// <param name="cachePolicy">The cache policy.</param> /// <param name="metrics">The metrics.</param> /// <param name="connectionInformation">The connection information.</param> public LinqCompileCacheDecorator( ILinqCompiler handler, MemoryCacheProvider cacheProvider, ICachePolicy <ILinqCompiler> cachePolicy, IMetrics metrics, IConnectionInformation connectionInformation) { _handler = handler; _cacheActions = Policy.Cache <Action <object, object> >(cacheProvider, new SlidingTtl(cachePolicy.SlidingExpiration) , OnCacheGetAction, OnCacheMissAction, (context, s) => { }, (context, s, arg3) => { }, (context, s, arg3) => { }); var name = handler.GetType().Name; _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items); _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items); _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items); }
/// <summary> /// Initializes a new instance of the <see cref="MessageMethodHandling" /> class. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="queueContainer">The queue container.</param> /// <param name="log">The log.</param> /// <param name="linqCompiler">The method compiler.</param> /// <param name="compositeSerialization">The composite serialization.</param> public MessageMethodHandling(IExpressionSerializer serializer, IQueueContainer queueContainer, ILogFactory log, ILinqCompiler linqCompiler, ICompositeSerialization compositeSerialization) { Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => queueContainer, queueContainer); Guard.NotNull(() => log, log); Guard.NotNull(() => linqCompiler, linqCompiler); Guard.NotNull(() => compositeSerialization, compositeSerialization); _serializer = serializer; _queueContainer = queueContainer; _linqCompiler = linqCompiler; _compositeSerialization = compositeSerialization; _log = log.Create(); _rpcQueues = new Dictionary <IConnectionInformation, IProducerQueueRpc <object> >(); }
/// <summary> /// Initializes a new instance of the <see cref="MessageMethodHandling" /> class. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="queueContainer">The queue container.</param> /// <param name="log">The log.</param> /// <param name="linqCompiler">The method compiler.</param> /// <param name="compositeSerialization">The composite serialization.</param> public MessageMethodHandling(IExpressionSerializer serializer, IQueueContainer queueContainer, ILogFactory log, ILinqCompiler linqCompiler, ICompositeSerialization compositeSerialization) { Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => queueContainer, queueContainer); Guard.NotNull(() => log, log); Guard.NotNull(() => linqCompiler, linqCompiler); Guard.NotNull(() => compositeSerialization, compositeSerialization); _serializer = serializer; _queueContainer = queueContainer; _linqCompiler = linqCompiler; _compositeSerialization = compositeSerialization; _log = log.Create(); _rpcQueues = new Dictionary<IConnectionInformation, IProducerQueueRpc<object>>(); }
/// <summary> /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class. /// </summary> /// <param name="handler">The handler.</param> /// <param name="cache">The cache.</param> /// <param name="cachePolicy">The cache policy.</param> /// <param name="metrics">The metrics.</param> /// <param name="connectionInformation">The connection information.</param> public LinqCompileCacheDecorator( ILinqCompiler handler, ICacheManager <object> cache, ICachePolicy <ILinqCompiler> cachePolicy, IMetrics metrics, IConnectionInformation connectionInformation) { _handler = handler; _cache = cache; _itemPolicy = cachePolicy; var name = handler.GetType().Name; _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items); _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items); _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items); _counterFunctionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHitCounter", Units.Items); _counterFunctionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items); _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items); }
/// <summary> /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class. /// </summary> /// <param name="handler">The handler.</param> /// <param name="cache">The cache.</param> /// <param name="cachePolicy">The cache policy.</param> /// <param name="metrics">The metrics.</param> /// <param name="connectionInformation">The connection information.</param> public LinqCompileCacheDecorator( ILinqCompiler handler, ObjectCache cache, ICachePolicy<ILinqCompiler> cachePolicy, IMetrics metrics, IConnectionInformation connectionInformation) { _handler = handler; _cache = cache; _itemPolicy = new CacheItemPolicy {SlidingExpiration = cachePolicy.SlidingExpiration}; var name = handler.GetType().Name; _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items); _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items); _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items); _counterFunctionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHiCountert", Units.Items); _counterFunctionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items); _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items); }