Avatar of MohitPandit
MohitPanditFlag for India

asked on 

C#: Window Service with thread pool

Hello Folks,

FYI, actually, I need to send emails from multiple databases (schema is same) then, I would like to use thread pool.
I would like to create a window service in C# which will be having below features:

1. I would like to use Thread Pool in window service;
2. The threads will be configurable like 2 threads.
3. The chunk size will be configurable like 5 i.e. records chunk size.
4. Could you please provide me code snippet for this?
Like,
a.) Aforesaid 1 to 3 points
b.) I need to put logic to utilize threads once idle. For example, two threads (using Thread Pool) are running in window service;
c.) And 500 emails need to send;
d.) Pre-assume, we have set 2 threads and 5 records chunk size; That means, 10 records records are processing in two threads
e.) So, window service logic should not wait to complete 10 records. In case one of the thread is free then assign next 5 records chunk size.

Best Regards,
Mohit Pandit
C#.NET Programming

Avatar of undefined
Last Comment
MohitPandit
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

then you need to enable a FIFO queue
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of MohitPandit
MohitPandit
Flag of India image

ASKER

Hi Sara,

Sure, I'll take a look over it and update you.

Best Regards
Avatar of MohitPandit
MohitPandit
Flag of India image

ASKER

Thanks
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo