This is a C# console application that demonstrates how to use a semaphore to limit concurrent access to Windward Fluent report generation when operating under a licensed thread limit.
The application spawns multiple threads, each attempting to generate a report using the Windward Fluent engine. A semaphore is used to restrict the number of concurrent report generations based on a configurable value.
- Limits the number of concurrent report processes to avoid exceeding licensed thread limits
- Uses
Semaphorefor thread synchronization - Demonstrates correct usage of the Windward Fluent
.NETAPI withReportDocx - Processes DOCX reports from XML data sources
- Supports configuration of maximum concurrent threads via
App.config
- .NET Framework
- Windward Fluent Engine libraries referenced (
net.windward.api.csharp,WindwardInterfaces) - A valid Fluent license
- Input template and XML data files
/files/
Fluent Trucking 2 - Template.docx
Fluent Trucking 2 - Data.xml
/out/
Report_0.docx
Report_1.docx
...
Report_9.docx
Program.cs
MyRunReport.cs
App.config
Set the maximum number of concurrent threads in App.config:
<appSettings>
<add key="NumberThreads" value="3"/>
</appSettings>- Ensure required input files are placed under the
filesdirectory. - Build and run the application.
- The application will:
- Initialize the Fluent engine
- Spawn multiple threads, each creating a report
- Enforce concurrency limit using a semaphore
- Write completed reports to the
outdirectory
- (optional) Add your license key to the App.Config by adding this section nested in the :
replace [[LICENSE]] with your license key. Leaving this out will result in watermarked output.
- Each report thread will sleep for 10 seconds after setup to simulate concurrency pressure.
Semaphore.WaitOne()andSemaphore.Release()are used to safely guard access to the engine.- Reports are created using
ReportDocx, reading from a DOCX template and an XML data file.
This sample assumes a valid Windward Fluent license and is provided for educational and demonstration purposes only.