Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method of constructing event bus RxBus based on RxJava

An event bus and event technology, applied in software engineering design, creation/generation of source code, instruments, etc., can solve problems such as difficult to test and track codes, confusion, etc., and achieve easy testing and tracking, simplified communication methods, and concise business codes Effect

Inactive Publication Date: 2019-01-29
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF7 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The technical problem to be solved by the present invention is: to overcome the EventBus method to implement event notification and subscription, which is difficult to test and track and cannot perform code confusion, and proposes a method for building an event bus RxBus based on RxJava

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

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method of constructing event bus RxBus based on RxJava

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0029] Such as figure 1 As shown, the method of building an event bus RxBus based on RxJava includes defining an event bus class, denoted as the RxBus class, in which the topic mapping object is defined, the instance method of generating the RxBus class, the registration method, the anti-registration method and the publishing event method;

[0030] The instance method for generating the RxBus class is used to generate an instance of the RxBus class in a singleton mode;

[0031] The subject mapping object is ConcurrentHashMap> type object, denoted as subjectMapper;

[0032] The registration method includes: using the class flag in the formal parameter of the registration method as a parameter to call the get method of subjectMapper to obtain the corresponding List type of array list; if the array list is empty, create the array list, and store the incoming class flag parameter and array list into subjectMapper; create a new PublishSubject object and convert it to a Se...

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 field of software development, overcomes problems of testing and tracking difficulty and code obfuscation incapability when an EventBus method is adopted for realizing event notification and subscription and proposes a method of constructing event bus RxBus based on RxJava, which includes defining event bus class, remembering the event bus class as RxBus class, defining the instance method of generating RxBus class, subject mapping object, registering method, logout method and publishing event method in RxBus class. The instance generation method of the RxBus classis used to generate an instance of the RxBus class in singleton mode; the registration method is used to create the subject object, establish the relation between the subject object and the passed class flag parameter, and return the Observable object. The logoff method is used to logoff related subject objects; the Publish Event method is used to publish content by publishing the topic corresponding to the class flag parameter. The invention is applicable to subscribing and publishing events in the RxJava framework.

Description

technical field [0001] The invention relates to the field of software development, in particular to a method for building an event bus RxBus based on RxJava. Background technique [0002] In 2012, in order to meet their huge user base, Netflix decided to redesign the architecture to reduce the number of REST service interface calls, replace dozens of REST service interface calls, and let the client process the required data by itself. They decided to create one based on client needs. The call of the specially optimized REST service interface. In order to achieve this goal, they decided to try to be responsive and migrate .NET Rx to the JVM. From this RxJava was born. RxJava is a library that uses observable queues on the JVM to compose asynchronous event-based programs. is a reactive programming framework and observer design pattern. The notification and subscription of the existing events are realized by using EventBus, which has low code readability, is difficult to test...

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): G06F8/30
CPCG06F8/315
Inventor 胡敏
Owner SICHUAN CHANGHONG ELECTRIC CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products