Solved

.Net void multi-threading

Posted on 2016-08-10
6
26 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
  • 3
  • 2
6 Comments
 
LVL 69

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 8

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 69

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 69

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now