473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Delayed Code Execution?

I realize that by design, web client/server interaction is disconnected.
I'm wondering if there is a way that when a client/server interaction
occurs, if there is a way to start a time on the web server which will
run some code after a specific amount of time (or variable amount of
time), such as send an e-mail.

We have a page that is a ticket page (computer support ticket page) that
employees use to submit a help/trouble ticket to IS. I want to be able
to have an e-mail sent back to their email account after a variable
amount of time, say, between 2 and 5 minutes. I already have a message
sent back when they submit their ticket, but I need to delay the
response email to them somehow. Any pointers?

TIA,
Jim
Sep 5 '06 #1
5 1643
KJ
Hello Jim,

I can think of a few ways to do this, for example:

1) Use message queues (MSMQ ala System.Messaging) and only read
messages that are of a certain age
2) Use SQL Server Service Broker queueing (if you have SQL 2005) and do
the same
3) Create a system.threading.timer, and set it to go off after a
certain amount of time elapses and execute your code
4) Create a simple work queue table in your DB, and mark the age of the
entries. Use a service program running on the server to retrieve the
messages and do the work.

Personally, I would consider 1 and 2 first, because they are by the
most reliable, but they can be heavy to implement. 3 and 4 are easy to
implement. But 3 might not be the most reliable choice. Let me know
what you choose to do. In a jam, I'd do number 4.

-KJ

Jim in Arizona wrote:
I realize that by design, web client/server interaction is disconnected.
I'm wondering if there is a way that when a client/server interaction
occurs, if there is a way to start a time on the web server which will
run some code after a specific amount of time (or variable amount of
time), such as send an e-mail.

We have a page that is a ticket page (computer support ticket page) that
employees use to submit a help/trouble ticket to IS. I want to be able
to have an e-mail sent back to their email account after a variable
amount of time, say, between 2 and 5 minutes. I already have a message
sent back when they submit their ticket, but I need to delay the
response email to them somehow. Any pointers?

TIA,
Jim
Sep 6 '06 #2
KJ wrote:
Hello Jim,

I can think of a few ways to do this, for example:

1) Use message queues (MSMQ ala System.Messaging) and only read
messages that are of a certain age
2) Use SQL Server Service Broker queueing (if you have SQL 2005) and do
the same
3) Create a system.threading.timer, and set it to go off after a
certain amount of time elapses and execute your code
4) Create a simple work queue table in your DB, and mark the age of the
entries. Use a service program running on the server to retrieve the
messages and do the work.

Personally, I would consider 1 and 2 first, because they are by the
most reliable, but they can be heavy to implement. 3 and 4 are easy to
implement. But 3 might not be the most reliable choice. Let me know
what you choose to do. In a jam, I'd do number 4.

-KJ
I'm not very advanced when it comes to dev (VB/ASPNET OR SQL), so most
of what you said went over my head pretty high. Option 3 sounds like
something I may be able to implement with much help and guidance.

When creating a system.threading.timer object, I'm guessing I do it
something like:

Dim objTimer As System.Threading.Timer
objTimer.

And that's as far as I get. There's a few options but I don't know which
one to use or how to implement it.

I also noticed in the object browser that there's System.Timers
namespace. I can't imagine that would work on a page since client/server
interaction is disconnected. I guess that's where threading comes in
instead?

Sep 6 '06 #3
KJ
Hi Jim,

Glad to hear back from you. I've been thinking a bit more about using a
threaded timer, and I am now feeling that this is not the best
solution, especially for a newer developer.

I think there is an easy way to do this, but it will require some
design work. A few questions first: are you using a database platform
such as SQL Server for your application? If so, do you have much
experience on that platform?

-KJ

Jim in Arizona wrote:
KJ wrote:
Hello Jim,

I can think of a few ways to do this, for example:

1) Use message queues (MSMQ ala System.Messaging) and only read
messages that are of a certain age
2) Use SQL Server Service Broker queueing (if you have SQL 2005) and do
the same
3) Create a system.threading.timer, and set it to go off after a
certain amount of time elapses and execute your code
4) Create a simple work queue table in your DB, and mark the age of the
entries. Use a service program running on the server to retrieve the
messages and do the work.

Personally, I would consider 1 and 2 first, because they are by the
most reliable, but they can be heavy to implement. 3 and 4 are easy to
implement. But 3 might not be the most reliable choice. Let me know
what you choose to do. In a jam, I'd do number 4.

-KJ

I'm not very advanced when it comes to dev (VB/ASPNET OR SQL), so most
of what you said went over my head pretty high. Option 3 sounds like
something I may be able to implement with much help and guidance.

When creating a system.threading.timer object, I'm guessing I do it
something like:

Dim objTimer As System.Threading.Timer
objTimer.

And that's as far as I get. There's a few options but I don't know which
one to use or how to implement it.

I also noticed in the object browser that there's System.Timers
namespace. I can't imagine that would work on a page since client/server
interaction is disconnected. I guess that's where threading comes in
instead?
Sep 6 '06 #4
KJ wrote:
Hi Jim,

Glad to hear back from you. I've been thinking a bit more about using a
threaded timer, and I am now feeling that this is not the best
solution, especially for a newer developer.

I think there is an easy way to do this, but it will require some
design work. A few questions first: are you using a database platform
such as SQL Server for your application? If so, do you have much
experience on that platform?

-KJ
I'm running a 2003 server (IIS6) with SQL2000 Standard (also on same web
server). I have a little knowledge of it, such as basic SQL commands and
basic server administration. I've considered upgrading it to 2005 but
always a little nervous about upgrading a production server. Since my
databases are very small and I've no large or imperative stored
procedures, views or triggers, I'm sure upgrading wouldn't be a problem.
I am planning on doing so soon, if I can get over the potential upgrade
disaster fear.

The internal website that i've mostly built has about 6 simple databases
.. Each database has no more than, say, 6 tables, with maybe two of them
related and the others just lookup tables. I've never used stored
procedures until recently when I decided to make a few to give them a
try, since I heard its the more secure way to go and better performance.

This whole delayed code execution thing isn't completely necessary. It
was a side thing I was going to do to make things look a bit less, um,
computer controlled. ;)
Sep 6 '06 #5
KJ
Instead of coding this, have you considered changing the mail-sending
frequency setting on your email server?

Jim in Arizona wrote:
KJ wrote:
Hi Jim,

Glad to hear back from you. I've been thinking a bit more about using a
threaded timer, and I am now feeling that this is not the best
solution, especially for a newer developer.

I think there is an easy way to do this, but it will require some
design work. A few questions first: are you using a database platform
such as SQL Server for your application? If so, do you have much
experience on that platform?

-KJ

I'm running a 2003 server (IIS6) with SQL2000 Standard (also on same web
server). I have a little knowledge of it, such as basic SQL commands and
basic server administration. I've considered upgrading it to 2005 but
always a little nervous about upgrading a production server. Since my
databases are very small and I've no large or imperative stored
procedures, views or triggers, I'm sure upgrading wouldn't be a problem.
I am planning on doing so soon, if I can get over the potential upgrade
disaster fear.

The internal website that i've mostly built has about 6 simple databases
. Each database has no more than, say, 6 tables, with maybe two of them
related and the others just lookup tables. I've never used stored
procedures until recently when I decided to make a few to give them a
try, since I heard its the more secure way to go and better performance.

This whole delayed code execution thing isn't completely necessary. It
was a side thing I was going to do to make things look a bit less, um,
computer controlled. ;)
Sep 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Leo Breebaart | last post by:
Hi all, I have a question about Python and delayed evaluation. Short-circuiting of Boolean expressions implies that in: >>> if a() and b(): any possible side-effects the call to b() might...
13
by: Brian | last post by:
Hi all... This question is more for the GURUs out there. It is not a question on how to do something, but why it happens, and I am trying to figure out if there is a pattern. I am using IE, but...
0
by: subi | last post by:
Hi, I don't know where's the best place to post my question. I hope it suits this group. I have created an assembly with a delay sign attribute set to true in the AssemblyInfo.cs. And the key...
4
by: Tony | last post by:
I'm having a problem with the execution of some code and the timing. Basically, I want each cell in a table of images to change, followed by a small delay, so that it creates an animation that...
3
by: Nospam | last post by:
I'm trouble shooting my obfuscated program. I'd like suggestions on some tools to help. I'm using vs2005 with delayed signing option from the project settings and reading the hash from a key.snk...
2
by: Amey Agnihotri | last post by:
Hi! I'm trying to run a few AT commands on a GSM modem. I'm doing this in C#.Net 2005. When I run a few commands one after the other, the response generation takes a long time. The response for...
10
by: Amey Agnihotri | last post by:
Hi! I'm trying to run a few AT commands on a GSM modem. I'm doing this in C#.Net 2005. When I run a few commands one after the other, the response generation takes a long time. The response for...
8
by: Grorange | last post by:
Writing ASP.NET pages, I have a need for client-side functions to prevent going to the server for every small change. I have a list of server side created checkboxes filled with a lot of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.