.NET Forum / .NET Framework / Distributed Applications / April 2007
Need advise on concept ???
|
|
Thread rating:  |
calderara - 13 Mar 2007 22:53 GMT Dear all,
I have different .NET libraries which should answer and execute proper operation based on external application message. Each assembly should listen from its own messages.
Messages are coming from an external application and my own assenblies should answer to those incomimg messages.
For that I was thinking to build a service that I could named "Message dispatcher". That service will listen to incoming message and then send it to proper assembly for processing.
Note that message will be asynchrone and as a first step all assemblies will be on the same machine.
For message handling I was thinking first to use this Message queue from COM+ component but I have no experience at all on those messaging process.
My questions are:
1 - Does the message dispatcher as a service is a good approach ? 2 - Does MS Queue under COM + is a good approach ? is it har to set up
Thnaks for all regards serge
Bryan Phillips - 14 Mar 2007 02:47 GMT MSMQ would work, but you could also use web services since they also support asynchronous calls.
-- Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com
> Dear all, > [quoted text clipped - 23 lines] > regards > serge calderara - 14 Mar 2007 07:51 GMT Thanks for your reply... Web service might be slower than MSMQ ? Does the "Message Dispatcher" define as a service is a good approach for that situation?
I have been been reading when defining components architecture for an application that components should be loosly couple whenever it is possible. Based on that does it mean that User interface which need to communicate with a buisness logic needs to do that through messages instead of having a reference to it ?
For instance I have a user interface with a button which need to get information from a logic contains in myLIb.dll. In normal way I woul do it by having a reference to that lib and then call a function inside myLib object to perform the proper action.
In loosly coupls way, do it means that the button_click should send a message somehow that the library will monitor and answer ?
serge
> MSMQ would work, but you could also use web services since they also > support asynchronous calls. [quoted text clipped - 31 lines] > > regards > > serge Bryan Phillips - 14 Mar 2007 21:43 GMT Web services are a little slower than MSMQ but they are easier to integrate cross-platform. If you are only using Windows, MSMQ is fine.
The Message Dispatcher is a good approach.
By loosely coupled, they mean don't use direct references that cross the boundaries of application tiers. Using messages or interfaces would satisfy this requirement.
Yes, your scenario would qualify as being loosely coupled. If this is a Windows Forms app, you will want to look at using the Composite UI Application Block to help with the UI side on your message handling architecture.
-- Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com
> Thanks for your reply... > Web service might be slower than MSMQ ? [quoted text clipped - 52 lines] > > > regards > > > serge calderara - 20 Mar 2007 08:34 GMT Hi bryan...
I have some more clarification based on those messages. If I ma using a WIndows service as a "message dispatcher", that service will simply place the proper message inside the proper queue to which my library will be register to. But my service will runing as a local Servcice account, so in a separate process as my library which could be as well as local or distributed on a differetn PC. In the case it is distributed, how my library can register to a Queue which is created on an other PC by this Service I ma planning to build ?
thnaks for help regards serge
> Web services are a little slower than MSMQ but they are easier to > integrate cross-platform. If you are only using Windows, MSMQ is fine. [quoted text clipped - 71 lines] > > > > regards > > > > serge Bryan Phillips - 21 Mar 2007 12:57 GMT To read or write to a queue on a different machine will require valid credentials for the other machine. I strongly suggest creating a domain account for this purpose and assign the account the appropriate permissions for the queues that you will be using.
-- Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com
> Hi bryan... > [quoted text clipped - 86 lines] > > > > > regards > > > > > serge calderara - 21 Mar 2007 15:10 GMT Thnaks for your reply....
Base on that what is the best place then to create the queue if my lIbrary is part of the buisness layer ? at the same place as the buisnee logic or on the client application machine ?
A last info as well if you don't mind:
If I catch correctly the Queue principle, the queue contains only Message string like "RqInit", then the application register to that queue and whne the application receive corresponding message then it can call for instance the proper function in myLibrary. Right ?
I guest you cannot pass parameter inside a message in the queue ?
regards serge
> To read or write to a queue on a different machine will require valid > credentials for the other machine. I strongly suggest creating a domain [quoted text clipped - 96 lines] > > > > > > regards > > > > > > serge Patrick Simpe-Asante - 28 Mar 2007 00:03 GMT Hi Serge,
I've had to solve a similar problem to what you have, and I also used something along the lines of a dispatcher service in conjunction with remoting and MSMQ messaging.
The requirements I had were that each responding component (or assembly in your case) had to be 'hostable' on a separate server, and in addition if required, each could be hosted in a server cluster (fronted by a load balancer). One other requirement I had (may not apply to you) was that the functionality had to be extensible (in addition to being distributed) after the deployment phase.
To solve this, I created two interfaces IClientPlugIn and IServerPlugIn, whose implementing assemblies/classes were hosted in designated folders at the client and server computers respectively. Each plug-in pair (client & server) had a matching task id (using attributes to decorate the plug-in classes). Also, each IClientPlugIn was a subclass of a generic class that provided methods for remoting.
To 'trigger' execution on the server, a special "initiator" console exe located on the client would be passed a task id at the command line - this task id was then used to locate an IClientPlugIn assembly/class (using reflection to match the task id), which in turn utilised its base class remoting functionality to connect to the server, and stream an XML document containing any required parameters over to the server. Note that each client plug-in had an accompanying configuration file (named the same as the assembly, but with ".config" appended) that included the address of the target server that hosted the component, as well as parameters wrapped/passed via the XML document.
At the server, a message dispatcher service would receive the remoting call, unwrap the XML received into an MSMQ message, and place this on an MSMQ queue. As an aside, to place the received params inside the MSMQ message, I constructed a XmlMessageFormatter passing in new Type[] { typeof(string) }, and assigned that to the message's "Formatter" property.
A second service running on the server, which was blocked on the messaging queue, would pick the message off the queue, retrieve the target task id and adorning parameters, and again using reflection, match the corresponding task id on the appropriate IServerPlugIn assembly/class and then execute the appropriate action as required.
One advantage with this approach was that to start off with, all components were hosted on the same server, however as loads increased, the components began to be spread across different physical servers (each with a dispatcher service installed) without the need for code changes, just configuration file edits. We are not there yet, however in the near future, it will be fairly straightforward task to utilise a load-balancer and have the same component hosted on multiple physical servers). In addition, use of the plug-in pattern meant that after deployment,it was simple to extend system functionality by creating new IClientPlugIn/IServerPlugIn pair assemblies and xcopying these into appropriate folders on the client and server, to be triggered as normal via the console initiator exe.
A few points to note: - in our set up, client's were not allowed to have MSMQ installed, hence use of remoting from client to server - this had the obvious drawback that servers had to be up-and-running to service remoting requests. Without this restriction, clients will likely have used messaging (instead of remoting) to the dispatcher service, which would have meant that message requests would have been placed on server queues for later processing even if the server components were down.
- our set up did not require asynchronous execution of receieved messages, so you'd have to do some extra work/thinking there
- use of this solution was in a closed environment so for remoting etc, it was acceptable to use tcp transport & normal messaging etc (which is not secure). Clearly, you'll need to re-think parts of this solution if high security is especially an issue.
Here's to hoping that this helps you somehow :-)
Kind regards, Patrick
 Signature Patrick Simpe-Asante MCAD, MSCD.Net
> Dear all, > [quoted text clipped - 23 lines] > regards > serge calderara - 02 Apr 2007 21:14 GMT HI patrick,
I have to say thnaks for your huge description and I have to admit that I get lost after a while.. :-(
For my case everything will work first on the same computer BUT I wold like to design it so that if one day or even a customer request means that i need to run it from different computer then I should be able to.
TO sunmmarize my case, I have an OEM application ( on which I have no control, not build by me) which is collecting different type information from machine. Machine information are based on alarms ( imagin your ca with a red light or warning displayed on your dashboard) that I have to record in database. When the OEM application gets an alarms, it is capable to post a message than new alarms occurs, then my .NET library should be able to catch that alarm, store it to database and then send nformation back to the OEM aplpication to informed that data has been stored, please send me the next one.
The messaging mecanism is nt yet define between that application and my .NEt library. As I have never made such kind of things yet, I was simply wondering what type of technology should I use for that case. (MSQ, simple remoting).
I was even thinking if I could use Workflow fondation for that.
At first I was thinking of having a Windows service which will initializing that message stuff, then OEM wil right into and my lib will read it ..
But dos a windows service is really he solution here? Does the messaging MSQ is the right choice ? Do I hev to use serviced component ?
All those question I ma still aking them and are quite fuzzy simply ecasue I know what I need but I do not know which technology best suite my need simply because of lack of knowledge of them. Even reading some article on msdn did not ring my bell for the time beeing...
Regards serge
> Hi Serge, > [quoted text clipped - 100 lines] > > regards > > serge Patrick Simpe-Asante - 10 Apr 2007 12:12 GMT Hi Serge,
Apologies, didn't mean to confuse, I highlighted a specific solution for a problem as an example of what can be done, rather than something should be adopted as a concrete design to your problem :-)
> For my case everything will work first on the same computer BUT I wold like > to design it so that if one day or even a customer request means that i need [quoted text clipped - 8 lines] > aplpication to informed that data has been stored, please send me the next > one. There are many options for achieving what you want including web services, remoting, messaging etc - I think your time might be better spent by initially putting the technology to one side, and working out exactly what *your* requirements are without consideration to tools. That way, you can then go through the distributed tools one by one, taking time to understand what unique feature each tool brings to the table, and evaluating them against *your* requirements, and deciding which aspect of what distributed tool can be used to solve which portion of your requirements.
> The messaging mecanism is nt yet define between that application and my .NEt > library. As I have never made such kind of things yet, I was simply wondering > what type of technology should I use for that case. (MSQ, simple remoting). > I was even thinking if I could use Workflow fondation for that. Perhaps you could add workflow to the list of tools to evaluate against your requirements...
> At first I was thinking of having a Windows service which will initializing > that message stuff, then OEM wil right into and my lib will read it .. > > But dos a windows service is really he solution here? A windows service is ideal in scenarios where you want your component to automatically start and be available after a machine reboot (possibly before a user logs in), so again if this is a requirement of yours then a building a windows service might be the thing for you - however as with the above, you need to test this theory against your requirements...
hope this helps,
Patrick
 Signature Patrick Simpe-Asante MCAD, MSCD.Net
> HI patrick, > [quoted text clipped - 140 lines] > > > regards > > > serge
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|