Solved

.Net void multi-threading

Posted on 2016-08-10
6
49 Views
Last Modified: 2016-08-10
I have a winforms app I inherited

In effect it opens with a task scheduler
Runs a sub (void) and closes

The SendMail void effectively sends 10,000 emails from a list it gets in SQL Server and send on to a providers smtp

That Provider allows 10,000 in a send....
But there can be multiple sends going on at the same time.

Is there a way to run the SendMail void in 5 separate "threads" so that 50k are being sent?

        SendMail(IsLive)
        Me.Close()
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41750443
you can wrap your code in a task and create 5 of them. Check http://emoreau.com/Entries/Articles/2013/10/SystemThreadingTask-class.aspx

but are you sure your provider will allow you to send 50,000 emails at the same time?
0
 
LVL 9

Expert Comment

by:Paweł
ID: 41750456
a task scheduler? what version of .net are you using?
0
 

Author Comment

by:lrbrister
ID: 41750466
Eric,
  50,000 at the same time in a "timeframe"

Pawel
.Net 4.5
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41750481
you can try to wrap your code in task as shown by my article and launch your tasks
0
 

Author Closing Comment

by:lrbrister
ID: 41750482
Very nice
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41750484
or just launch your job from the task scheduler 5 times with a parameter to process a different set of records in each instance
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question