예제 #1
0
        protected virtual string GetRecord(IEnvelope envelope)
        {
            string record = envelope.GetMessage(_format);

            switch ((_format ?? string.Empty).ToLower())
            {
            case ConfigConstants.FORMAT_JSON:
                if (_objectDecorationEvaluator != null)
                {
                    IDictionary <string, string> attributes = _objectDecorationEvaluator.Evaluate(envelope);
                    record = JsonUtility.DecorateJson(record, attributes);
                }
                break;

            case ConfigConstants.FORMAT_XML:
            case ConfigConstants.FORMAT_XML_2:
            case ConfigConstants.FORMAT_RENDERED_XML:
                //Do nothing until someone request this to be implemented
                break;

            default:
                if (_textDecorationEvaluator != null)
                {
                    record = _textDecorationEvaluator.Evaluate(envelope);
                }
                break;
            }
            return(record);
        }
        protected virtual string GetRecord(IEnvelope envelope)
        {
            string record = envelope.GetMessage(_format);

            switch ((_format ?? string.Empty).ToLower())
            {
            case "json":
                if (!string.IsNullOrWhiteSpace(_objectDecoration))
                {
                    IDictionary <string, string> attributes = new Dictionary <string, string>();
                    string[] attributePairs = _objectDecoration.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var attributePair in attributePairs)
                    {
                        string[] keyValue = attributePair.Split('=');
                        string   value    = ResolveRecordVariables(keyValue[1], string.Empty, envelope);
                        if (!string.IsNullOrEmpty(value))
                        {
                            attributes.Add(keyValue[0], value);
                        }
                    }
                    record = JsonUtility.DecorateJson(record, attributes);
                }
                break;

            case "xml":
                //Do nothing until someone request this to be implemented
                break;

            default:
                if (!string.IsNullOrWhiteSpace(_textDecoration))
                {
                    record = ResolveRecordVariables(_textDecoration, record, envelope);
                }
                break;
            }
            return(record);
        }
        protected override bool Filter(IEnvelope <T> value)
        {
            string textRecord = value.GetMessage(null);

            return(_filter.IsMatch(textRecord));
        }
예제 #4
0
        protected override bool Filter(IEnvelope <T> value)
        {
            var isMatch = _filter.IsMatch(value.GetMessage(null));

            return(_negate ? !isMatch : isMatch);
        }