Solved

shared queue/memory for 2 applications.

Posted on 2011-09-29
8
235 Views
Last Modified: 2013-12-16
Hi there;

In C# I have an app, let's say program A, dealing with a queue having some requests of customers.

The client request starts a program, let's say, program B.

What I want is that if there are let's say 5 instances of Program B., I want to suspend the starting of program B for the 6. instance until sources are available.

My thinking is that I have to have a router server program, C, checking for it and shares the queue of program A, and initiates a program B accordingly if the resources are emptier.

So, what I need is that I need to know how to share that queue.

How to do?

Kind regards.
0
Comment
Question by:jazzIIIlove
8 Comments
 
LVL 4

Expert Comment

by:theHollow
ID: 36816254
Hello
I don't know if this is ideal for this problem in particular.

But I would start thinking about this in a "Service + clients" way.
Where I have a service (for instance a WCF Service or a Web Service).
And then there is the client, which connects to the service on start.

All business logic can be moved to the service, which handle requests and operations in an inner queue.
The clients request methods from the service when it needs to get or set data.

The service may also be made available on the intranet, as well as on the internet.
That way, the clinents may not be located on the same server.
The clients may not even be of the same type. You can create clients like Windows client, Silverlight client and a standard web client.
All of which gets the same functionality from the service.

Hope it was at any help :-)
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 36816312
I already implemented your above comment but what i need as in the question that i have to have a shared queue, how can i handle this? Any example code for such queue object sharing between different apps in C#?

Regards.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36816385
Hello, may be you can use the System.Diagnostic.Process class to do that, then by using a windows service (as theHollow suggest) you can control how many instances of application B can be running at the same time (by using the System.Diagnostic.Process class), I think that a service is a good design to do this because you only will have an entry point where your clients will make the request to start program B, so you can manage a queue of these.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 4

Expert Comment

by:theHollow
ID: 36816468
Hello
What I meant with the service and client, is that there is no use for a shared queue.
No communication between apps. The service is the cener.
The service will hold the queueing. The clients will push and pop items to the "shared queue" by sending requests to the service.

But I am not sure if that is suitable for this problem :-)
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 36816540
Ok but can you provide a code for;

"The service will hold the queueing. The clients will push and pop items to the "shared queue" by sending requests to the service."

Regards.
0
 
LVL 13

Accepted Solution

by:
Pryrates earned 500 total points
ID: 37013431
Have a look here:
http://www.codeproject.com/KB/WCF/publisher_subscriber.aspx

Its the publisher / subscriber pattern via WCF. A central service that all clients "subscribe" to and the central service publishes (pushes) notifications / information / data to it's subscribers.
This might fit your needs :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

813 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

13 Experts available now in Live!

Get 1:1 Help Now