Distributed Message Processing Framework Based on. remoting

Source: Internet
Author: User

Many applications are based on servers and clients, which can distribute functions to different computers and greatly improve the flexibility of the system. This operation feature is that the client sends a message to the server, and the server returns the result to the client for processing. The. NET platform provides two solutions: WebService and remoting. Remoting provides strong remote object processing capabilities. Based on remoting, you can quickly establish your own message processing framework to facilitate distributed system processing.

(Figure 1)
1. Define the message interface and message processing interface
Before determining the function, you must formulate the specifications to facilitate the work.
Define the message interface rules as simple as possible. Of course, the object cannot be too extensive or express the purpose.
Message rules:
Public interface iMessage
{
String ID
{
Get;
}
String name
{
Get;
Set;
}
Object Body
{
Get;
Set;
}
}
The message rules are clear, and the rules that can process messages must be clear. Without this rule, you cannot work because messages and processed classes can be bound with no information.
Message Processing rules:
Public interface idispense
{
Void accept (iMessage message, servercontext context );
}
2. Create configuration files related to message and Service Processing
This one serves as a bridge, which tells the message processing container to execute those functions for different messages.
You can describe the functions that messages trigger:
<Message blltype = "classname, assembly" msgtype = "classname, assembly" single = "bool"/>
You can also describe all messages in the namespace to trigger those functions.
<Message blltype = "classname, assembly" msgtype = "namespace. *, assembly" single = "bool"/>
Single is used to describe whether to process only one object of an instance or instantiate each message separately.
3. Specify a message distribution processing container
The message processing container is mainly used for management and message distribution. After receiving a message, the server sends it to the container for processing. The Container processes the message based on the type of the message and triggers the corresponding function.
Class 4 Graph

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.