VRS simple interface <serial 5>—C# calls through the rule service Socket

Make a HelloServer class in VS, pass the name parameter to the rule service, and call the hello rule package to display the returned greeting.

Create a new C# project
In VS, create a new project for a console application named HelloServer:



Add Reference
Add RuleEngine.dll to the reference. This file is generally located in the samples\notnet\RuleEngine\bin\Release directory of the VisualRulesSolution installation directory:



write the Program.cs
code as follows, where 192.168.19.128 is the server address:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RuleEngine;
namespace HelloServer
{
    class Program
    {
        static void Main(string[] args)
        {
            RuleServerPoolFactory factory = RuleServerPoolFactory.getFactory("192.168.19.128", 1508);
            RuleService service = factory.RuleService;
            service.put("name", "Test Socket Access");
            service.execute("hello");

            Console.WriteLine( service.getString("welcome") );
            Console.Read() ;
        }
    }
}
Execute the test class After
clicking execute, you will see the execution result as follows, indicating that the rule package has been successfully invoked:



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326820217&siteId=291194637
VRS