locked
Write a .Net Class to Modify a message in Pipeline from Business Rule Engine RRS feed

  • Question

  • I have a requirement where i have to modify the incoming message in Receive pipeline which i want to do using BRE Pipleline , I have written the Code in a console Application for Testing purpose but how to write a separate assembly and use in BRE Vocabulary , I know how to use the BRE Pipeline to call the Polict but need help with .net assemble , Below is the code which i wrote and working 

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Threading.Tasks;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
    
    
            {
    
                String sourceDirectory = @"C:\Console\New folder\In.txt";
                String targetDirectory = @"C:\Console\New folder\Out.txt";
    
    
                var all = File.ReadAllLines(sourceDirectory).ToList();
                var dataLines = all.Where(l => Regex.IsMatch(l, @"^\d+"));
                var lines = all.Take(2).Concat(dataLines).ToList();
                File.WriteAllLines(targetDirectory, lines);
    
    
    
            }
        }
    }
    
    

    Appreciate the help 



    Sukra



    • Edited by sukra1234 Wednesday, November 25, 2020 5:24 PM
    Wednesday, November 25, 2020 5:22 PM

Answers

  • Are you using the BRE Pipeline Framework?

    What exactly are you having a problem with?

    Also I would not use the code in your console app in a Pipeline if the files are going to be large, as that would cause memory issues as it would load the entire message into memory and cause issues.  I prefer to use streaming wherever possible.


    • Marked as answer by sukra1234 Friday, December 18, 2020 4:55 PM
    Wednesday, November 25, 2020 9:43 PM