In this blog we demonstrate the In-Process Corticon .NET Object Messaging Technique using the Cargo Tutorial Example, a useful performance-enhancing tactic. This tutorial is designed for Corticon 5.5.2.
With large payloads, performance benefits are critical. The In-Process Object Message technique has performance benefits over XML messaging when large payloads are involved. The biggest performance hit in XML messaging is the overhead to convert the incoming XML into Corticon Data Objects (CDOs) before any Rules fire. An in-process object call is 50%-90% faster depending on the size of the XML documents and the complexity of the rules.
In this scenario, as a .NET developer your responsibility is to write .NET code to instantiate a Corticon .NET Server, deploy Ruleflows as Decision Services, send request messages to the Decision Services and receive response messages from the Decision Services. Let’s demonstrate how to use this technique and gain the performance improvements I spoke about above.
To use this technique you must follow the steps below:
Run install.bat—this will copy all the Corticon .NET Server .dll and .jar files to C:/inetpub/wwwroot/axis.
Replace the CcLicense.jar in C:/inetpub/wwwroot/axis/lib folder with your permanent CcLicense.jar. Make sure axis and all of its sub folders have “Everyone” permissions.
When you write the class, the class name and the entity name must match exactly. The letter-case (uppercase/lowercase) should also be the same. All the entity classes should be defined under the same namespace.
To do this, open the Microsoft Visual Studio Command Prompt and run the following command:
csc /t:library /out:<OutputDLLFileName.dll> <EntityClassFileName>
For the Cargo example, the .dll file is named based on the namespace. The program file name that contains the entity classes is CargoLibrary.cs. So the following command is run:
csc /t:library /out:CargoLibrary.dll CargoLibrary.cs
Go to: <Corticon_Server_Install_Dir>/Server.NET/samples/gen stubs
Copy the compiled CargoLibrary.dll file to this location.
Open GenStubs.bat batch file in an editor.
Modify the SET INPUT_DLL_NAME property and specify the CargoLibrary.dll file that you compiled in the previous step.
Modify the SET OUTPUT_JAR_NAME property and specify the name of the output .jar file, i.e. CargoLibrary.jar.
Save and close the .bat file
Run the GenStubs.bat file. (You can ignore the ‘File not found…’ message in console if it appears)
Ensure that the CorticonLibrary.jar file is created in: <Corticon_Server_Install_Dir>/Server.NET/samples/gen stubs
Open the Vocabulary.
Ensure Studio is in Integration and Deployment mode.
Select Vocabulary > Java Object Messaging > Import Java Class Metadata.
In the Import Java Class Metadata window:
Copy the .jar file to: <Corticon_Server_Install_Dir>/Server.NET/samples/lib and C:/inetpub/wwwroot/axis/lib
Copy the .dll file to: <Corticon_Server_Install_Dir>/Server.NET/samples/bin and C:/inetpub/wwwroot/axis/bin
Launch DeployConsole.exe application from: <Corticon_Server_Install_Dir>/Server.NET/samples/bin
Pre-compile tutorial_example.erf into an .eds and save it in: C:/inetpub/wwwroot/axis/Rules
Save the .cdd file in: C:/inetpub/wwwroot/axis/cdd
(This is an optional step and helps reduce the time taken to load the .eds file into memory. This is useful, if you are dealing with large ruleflows and need to deploy multiple decision services)
Go to: <Corticon_Server_Install_Dir>\Server .NET\samples\compile assembly folder
Copy .eds file from: C:/inetpub/wwwroot/axis/Rules to this location
Copy CargoLibrary.jar from: C:/inetpub/wwwroot/axis/lib to this location
Edit CompileAssembly.bat batch file in an editor.
SET INPUT_EDS_FILE_NAME="..\compile assembly\Cargo_v0_16.eds"
SET REFERENCE_JAR_FILE_NAME="..\compile assembly\CargoLibrary.jar"
Save and close the batch file.
The .eds file in <Corticon_Server_Install_Dir>\Server .NET\samples\compile assembly folder is an updated .eds file that contains the Assembly.dll.
You may use this .eds file with Assembly.dll in C:/inetpub/wwwroot/axis/Rules.
The code in the screenshot below was written in Visual Studio Express 2012:
Based on the rules, for an input volume of 10 and weight of 1000, the response should post container=standard
You can try various other input combinations to test the rules and obtain the respective responses.
Ensure the following properties are enabled in C:/inetpub/wwwroot/axis/conf /CcServer.properties
com.corticon.server.embed.managementPort—The embedded tomcat listing port. Defaults to 9850.
Start the web console from C:\Program Files\Progress\Corticon 5.5\Server\bin\startServer.bat
On a browser, go to http://localhost:8850/corticon. Log in as admin/admin.
Add a Server to register the InProcess Server on port 9850 and monitor it.
If you'd like to try this for yourself, feel free to grab the code and necessary files I've presented above right here.
With that, you should be able to realize some significant performance gains while using Progress Corticon. Don’t forget to check out what’s new in Progress Corticon to learn more about the newest updates and features available in our latest release.
Jan is a Sr. Support Engineer at Progress. She is responsible for assisting Progress customers and application partners solve technical issues by providing efficient and effective technical support. She has background in the areas of Business Rules, Database Drivers, Business Process Management, Complex Event Processing.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.