Intermodular message transmission mechanism based on event bus

An event bus and message passing technology, applied in the field of programming, can solve problems such as serious module coupling, and achieve the effect of enhancing the use of interface hierarchy

Inactive Publication Date: 2015-02-18
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF7 Cites 37 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the present invention is to solve the problem of se

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0018] The present invention aims at the problem of severe coupling between modules in the existing software programming process, and proposes a message transmission mechanism between modules based on an event bus, including the following steps:

[0019] A. Implement and mark the subscription functions of various events in the subscriber class, and the subscriber registers events with the event bus;

[0020] B. After the event bus registers the event, find out the subscription function marked in the registration object through the reflection mechanism, and generate the subscriber object;

[0021] C. Use the subscription event as the key, and use the map to maintain the subscriber information. The subscriber information includes the subscriber object, callback event function and event type;

[0022] D. Analyze the subscriber object through the reflection mechanism, determine the event execution method according to the method name of the callback event function callback, and tra...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention relates to the programming technology, in particular to a message transmission method for different functional modules, with an aim of solving the problem of serious intermodular coupling during the prior software programming. The invention provides an intermodular message transmission mechanism based on an event bus. The intermodular message transmission mechanism comprises the following steps: firstly, subscription functions for various events are obtained and labeled in subscriber categories, and a subscriber registers an event with the event bus; secondly, after the event bus performs the event registration, a labeled subscription function in a registered object is found through a reflex mechanism, and a subscriber object is generated; thirdly, a subscription event is considered as a key, a map is used for maintaining subscriber information, and the subscriber information includes the subscriber object, a callback event function and an event type; finally, the subscriber object is analyzed through the reflex mechanism, an event execution mode is determined according to a Method name called back by the callback event function, and the map is traversed for event dispatch. The invention applies to the programming field.

Description

technical field [0001] The invention relates to programming technology, in particular to a method for message transmission between different functional modules. Background technique [0002] In the application development process, we always encounter communication between various component modules. With the increase of application functions, more and more events need to be monitored, and more and more modules need to monitor different events, resulting in a large number of Modules need to be registered to each event manager, resulting in severe coupling between modules. The code is not easy to maintain and test, and even when some bugs appear, it will be impossible to start. [0003] The ultimate goal of software products is loose coupling. The degree of coupling between modules should be reduced as much as possible, and the principle of "high cohesion and low coupling" in software engineering should not be violated. The emergence of many technologies is to solve coupling ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/48
Inventor 龚翔程超李奇罗永江陈锡林
Owner SICHUAN CHANGHONG ELECTRIC CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products