[Original] Heterogeneous Database Synchronization applications based on Windows Services

Source: Internet
Author: User
Tags msmq

Author: Jack

Abstract:Enable
Using Windows Services to implement data subscription and distribution process and MSMQ message queue for transmission can solve Heterogeneous Database Synchronization across network segments. Heterogeneous Databases belong to different systems,ArticleMain
A task is the integration of multiple systems. Based on the application and research of actual projects, the system requirements, system design, and system implementation are analyzed to provide a complete set of solutions to achieve
.

Keywords: MSMQ,WindowsService,XMLPacket, data exchange,WebService

With the development and application of electronic information, various enterprises have developed and applied their own information systems. Different units use different development technologies and backend databases, which are separated and irrelevant. Enterprise Integration can not only create three(Presentation layer, business layer, and data access layer)Layer application structure, which can also distribute an application to multiple computers. In distributed applications, a single layer cannot run on its own, and every application in the integrated application can run independently. Their time passes through coupling to complete functions. Asynchronous message transmission architecture is used to integrate multiple applications. The synchronization problem of heterogeneous databases is an urgent problem in real projects.

1 System Requirements

The main task of electronic data exchange is to achieve data exchange and system integration between different systems and services. It is the distribution chart of various systems in a real project (figure1),
Systems are independent from each other and use different databases. First, the enterprise uses the one-stop reporting platform to send the declaration documents to the customs for approval. If the Customs approves the application
The information status is changed, and then the enterprise sends the vehicle information to the Logistics Park Station System. The station system receives the permit information from the Customs end and the vehicle information sent by the enterprise end to allow the vehicle.



Figure1

 

Figure2

The entire system is independent of each other.WindowsThe Service monitors its own database. After the corresponding table is changedXMLPacket, set by routeMQThe message queue sends messages to the receiving end, and the receiving end Service receivesMQAfter the packet is sentXMLMessage Parsing enters the acceptor database. Define and use each messageSchemaTo complete the definition, onlySchemaThe message defined by the rule can be transmitted in the message queue. For example, Customer RelationshipSchemaThe message definition is as follows:(Figure 2)As shown in, onlySchemaOnly formatted reports can be generated.XMLPackets are transmitted.

2 System Framework

 

 

Figure 3

For example(Figure3)As shown in, the transmission system usesWindowsServices to complete data transmission; it can be seen that the internal includes the following components:

(1) windowsserve_fuzhou: Windows service component, responsible for data transmission throughout the system; warehouse picking action: adapter the component receives changes to its own database. By configuring the specified schema Generate XML message, send the message to MQ message queue. Receiving action: received MQ XML message, through the corresponding schema parse the message format, the adapter component allows messages that meet the format requirements to enter their own database tables.

(2)MSMQ: Message Queue transmission component, responsibleXMLTransmission of packets;

(3)Biztalk_message:Packet definition, parsing, routing, and configuration components are the core of the entire transmission system. Use the configuration file to complete the preceding configuration, improving the system flexibility.

(4) log: the System Log Module is used for packet transmission tracking and debugging, establish a unified log monitoring platform to monitor each packet and analyze abnormal packets, the Web page is displayed to the customer.

(5)Sqladapter_fuzhou:Database(Sqlserver)Monitoring component. After the corresponding table in the database is monitored,AdapterThe component startsBiztalk_messageThe message processing module performs operations on records in the data table and writes data into and out of the database. The data access layer of the Service uses the traditional three-tier architecture, such(Figure4)As shown in, the database and the transmission service are usedAdo.netAccess the database through the data access layer(DAL)And business logic layer(BLL)Completed to improve the readability and flexibility of the system;

 

Figure4

(6)Oracle adapter:Database(Oracle)Monitoring componentOracleThe database is monitored.AdapterMultiple database access interfaces are implemented. If there is a new database type, you only need to add the correspondingAdapterThe corresponding database can be synchronized;

(7)Security_module: The encryption and decryption component in the message transmission process. The system uses the certificate encryption mechanism to completeXMLEncryption and decryption of packets;

DetailsCodeAs follows:

 

3 System deployment

After the system compilation and testing are completed, you need to deploy the service to the corresponding system. Each system is separated by a gateway, as shown in figure(Figure 1)As shown in, the one-stop platform, Customs terminal system, and site system respectively deploy their own services. Services work collaboratively to receive and send packets. Specific deployment includes modifying the configuration file,DLLDynamic Link Library assembly(WhereSchemaThe definition module needs to be assembled under the Operating System Directory)To run database scripts and install specific services.(It mainly includes database connection settings and packet monitoring system settings.). After the installation and deployment are completeWindowsThe system is deployed to synchronize different databases. The actual project is running well.

4 Conclusion

Article passedWindowsThe Service's data subscription and distribution mechanism provides some specific solutions for data exchange.XMLThe definition, resolution, and configuration of packets are the core tasks of system implementation. You can also use other technologies to transfer data, suchBiztalkSystem transmission improves system stability, and workflow transmission improves the flexibility of System Process configuration. Detailed analysis and description are not provided here.

 

References

[1] http://www.cnblogs.com/chnking/archive/2007/08/30/875947.html

 

Special thanksJackContribution

Related Article

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.