473,387 Members | 1,678 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,387 software developers and data experts.

General MSMQ and C# question

Hi all...

I'm working on a project that uses MSMQ as its core for inter-process
communication. At the moment there is a single process that listens for
inbound TCP-based messages on a socket, and when something is received it
gets packaged up and sent to an MSMQ queue for further processing.

The process on the listening end of this queue will process the message and
either (a) send a response to the originator, or, (b) send an "internal"
message to another process for further work.

(a) is achieved by sending to a general "outbound" MSMQ queue which then
responds via TCP to the originator of the message.
(b) is achieved by sending the message onto the relevant queue for the
process to do the further work...
(I hope i haven't lost anyone by now! ;) )

Now, if I have, say, 40 processors, that means 40 queues (plus the general
"outbound" queue). The single TCP-listener process will have a hashtable of
40 MessageQueue objects, each ready to send to the appropriate worker
process.

Each worker process will listen to its own queue and send to the general
"outbound" queue.

For inter-process communications, each worker process has a hashtable of 39
MessageQueue objects, each ready to send to any of the other worker
processes...

I'm not sure if this is the best way of doing this... any suggestions???

Thanks!
Claudia


Dec 8 '05 #1
3 1284
Claudia,
From your description it isn't entirely clear why you feel you need such a
complicated (and potentially resource-intensive) setup. Wouldn't it be
possible to have a single MessageQueue and use something like - for example
-- the Message label to tell the processor which process it is destined for?
Then you could have a sort of "broker" class that would read the message
label and based on a simple switch statement, send it on to the respective
class to handle that specific processing.

if each message is derived from an Interface that has a generic "Execute"
method, all you would need to do is read out the payload and deserialize it
to an instance of the Interface and call the method...

Just my 2 cents.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Claudia" wrote:
Hi all...

I'm working on a project that uses MSMQ as its core for inter-process
communication. At the moment there is a single process that listens for
inbound TCP-based messages on a socket, and when something is received it
gets packaged up and sent to an MSMQ queue for further processing.

The process on the listening end of this queue will process the message and
either (a) send a response to the originator, or, (b) send an "internal"
message to another process for further work.

(a) is achieved by sending to a general "outbound" MSMQ queue which then
responds via TCP to the originator of the message.
(b) is achieved by sending the message onto the relevant queue for the
process to do the further work...
(I hope i haven't lost anyone by now! ;) )

Now, if I have, say, 40 processors, that means 40 queues (plus the general
"outbound" queue). The single TCP-listener process will have a hashtable of
40 MessageQueue objects, each ready to send to the appropriate worker
process.

Each worker process will listen to its own queue and send to the general
"outbound" queue.

For inter-process communications, each worker process has a hashtable of 39
MessageQueue objects, each ready to send to any of the other worker
processes...

I'm not sure if this is the best way of doing this... any suggestions???

Thanks!
Claudia


Dec 8 '05 #2
Why do you have a TCP listener? It seems to be unnecessary over head. One
approach is to configure the Queue with remote access and send the messages
directly to the queue. Since the queue already implements message
confirmation, you can eliminate that part of your application that is
responsible for notification.

Configure the queue with triggers so that messages that need to be forwarded
on internally are automatically forwarded or handled by the queue framework.
The thing is, you've built a lot of functionality into your applications
that are already robustly implemented in the queue framework.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Claudia" <cl*************************@hotmail.com> wrote in message
news:43*********************@news.zen.co.uk...
Hi all...

I'm working on a project that uses MSMQ as its core for inter-process
communication. At the moment there is a single process that listens for
inbound TCP-based messages on a socket, and when something is received it
gets packaged up and sent to an MSMQ queue for further processing.

The process on the listening end of this queue will process the message and either (a) send a response to the originator, or, (b) send an "internal"
message to another process for further work.

(a) is achieved by sending to a general "outbound" MSMQ queue which then
responds via TCP to the originator of the message.
(b) is achieved by sending the message onto the relevant queue for the
process to do the further work...
(I hope i haven't lost anyone by now! ;) )

Now, if I have, say, 40 processors, that means 40 queues (plus the general
"outbound" queue). The single TCP-listener process will have a hashtable of 40 MessageQueue objects, each ready to send to the appropriate worker
process.

Each worker process will listen to its own queue and send to the general
"outbound" queue.

For inter-process communications, each worker process has a hashtable of 39 MessageQueue objects, each ready to send to any of the other worker
processes...

I'm not sure if this is the best way of doing this... any suggestions???

Thanks!
Claudia

Dec 8 '05 #3
http://www.apress.com/book/supplemen...10003&sID=3050

Check the Chapter 8 example.
You could do 1 queue, or maybe 2. Put not >2.

You need to just label each messgae with a machine name.

.....

\firstlevelqueue
\secondlevelqueue

Send your initial messages to firstlevelqueue.
Create an object like

public class MyObject
private int m_processorNumber;
public int ProcessorNumber{ get { return this.m_processorNumber;} }
public MyObject (int processorNumber)
{ this.m_processorNumber = processorNumber; }

And then you can put an instance of MyObject into the BODY of the Q message.

....

Then you write a Windows Service, which is your "Poller" (aka, polls the
firstlevelqueue every X seconds)

You write your businesslogic to handle your if/else.

The reason I advocate 2 queues...is that it is a little easier ....when you
read the messages from the Q.. and you have to cast them as MyObject.

Check the sample in that zip download (top of this email).

You may have to rewrite it a little if you have 1.1, but you can do this.

I think the example has public class Document....where this would become
your MyObject.
...

I think a different N queue for every N processor you have .... is a bad
design.
(aka, 40 processors = 40 queues....)

"Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
Why do you have a TCP listener? It seems to be unnecessary over head. One
approach is to configure the Queue with remote access and send the
messages
directly to the queue. Since the queue already implements message
confirmation, you can eliminate that part of your application that is
responsible for notification.

Configure the queue with triggers so that messages that need to be
forwarded
on internally are automatically forwarded or handled by the queue
framework.
The thing is, you've built a lot of functionality into your applications
that are already robustly implemented in the queue framework.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Claudia" <cl*************************@hotmail.com> wrote in message
news:43*********************@news.zen.co.uk...
Hi all...

I'm working on a project that uses MSMQ as its core for inter-process
communication. At the moment there is a single process that listens for
inbound TCP-based messages on a socket, and when something is received it
gets packaged up and sent to an MSMQ queue for further processing.

The process on the listening end of this queue will process the message

and
either (a) send a response to the originator, or, (b) send an "internal"
message to another process for further work.

(a) is achieved by sending to a general "outbound" MSMQ queue which then
responds via TCP to the originator of the message.
(b) is achieved by sending the message onto the relevant queue for the
process to do the further work...
(I hope i haven't lost anyone by now! ;) )

Now, if I have, say, 40 processors, that means 40 queues (plus the
general
"outbound" queue). The single TCP-listener process will have a hashtable

of
40 MessageQueue objects, each ready to send to the appropriate worker
process.

Each worker process will listen to its own queue and send to the general
"outbound" queue.

For inter-process communications, each worker process has a hashtable of

39
MessageQueue objects, each ready to send to any of the other worker
processes...

I'm not sure if this is the best way of doing this... any suggestions???

Thanks!
Claudia


Jan 31 '06 #4

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

Similar topics

0
by: Andrew Gordon | last post by:
I'm investigating getting Microsoft Navision to do stuff from a Python script. The recommended way seems to be to use message queues (MSMQ). I can get Navision to send a message to itself fine. I...
0
by: Chipster | last post by:
Hello, I have a SQL server being the recipient of a message. The message comes in via TCP/IP and is sent to MSMQ. From there it is picked up by a COM+ object which puts the message into SQL...
0
by: Rudy | last post by:
I'm testing MSMQ 3.0 via HTTP. Our network configuration is as follows: A. Windows 2003 Server Edition in Site1 Queue messages are sent from here. B. Windows 2003 Web Edition in Site2 This...
2
by: Przemo | last post by:
Hi, I want to send messages from one application to another, working on 2 different computers in a no-domain enviroment using private queues. Am I to place queue on the source or on the...
5
by: Alex Nitulescu | last post by:
Hi. I'm trying to make MSMQ work, so I go to Control Panel, Windows Components, I select MSMQ (Message Queuing Client Setup, actually) and about half-way through I get a nice message box saying ...
3
by: kd | last post by:
Hi All, I am working on Windows XP. I guess, Microsoft Message Queuing is not installed by default. Can anybody give me a link from where I can download the same? Thanks. kd
2
by: kd | last post by:
Hi All, Can Windows message queues be used to communicate between 2 applications running on the same computer? I am not sure whether this is possible, if it is possible how can this be compared...
3
by: Claudia | last post by:
Hi all... I'm working on a project that uses MSMQ as its core for inter-process communication. At the moment there is a single process that listens for inbound TCP-based messages on a socket,...
11
by: Jon Davis | last post by:
Can a solution built in C# utilize MSMQ and/or MTS? If so, does this make the training material I already have on MSMQ and MTS in the context of VB6 an appropriate prerequisite foundation before...
1
by: Florence Tissot | last post by:
We are seeing some kind of resource leak in our performance lab running an ASP.NET (2.0) application that sends and receives messages from 2 public MSMQ queues. Here's a brief summary of what are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.