CN107741884B - Method and device for realizing message pushing by hierarchical state machine - Google Patents

Method and device for realizing message pushing by hierarchical state machine Download PDF

Info

Publication number
CN107741884B
CN107741884B CN201710930050.3A CN201710930050A CN107741884B CN 107741884 B CN107741884 B CN 107741884B CN 201710930050 A CN201710930050 A CN 201710930050A CN 107741884 B CN107741884 B CN 107741884B
Authority
CN
China
Prior art keywords
layer
message
receiving layer
receiving
exchange
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710930050.3A
Other languages
Chinese (zh)
Other versions
CN107741884A (en
Inventor
尹成
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710930050.3A priority Critical patent/CN107741884B/en
Publication of CN107741884A publication Critical patent/CN107741884A/en
Application granted granted Critical
Publication of CN107741884B publication Critical patent/CN107741884B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a method and a device for realizing message pushing of a layered state machine, which comprises a receiving layer, an exchange layer, a routing layer and a consumption layer, wherein the receiving layer receives messages which are sent by a server and come from different platforms respectively; secondly, the receiving layer transmits the received message and the exchange layer to the exchange layer by running the received message and the exchange layer in the same process by two different threads respectively; then, the exchange layer performs unified format conversion on the message and transmits the message to the routing layer; and finally, the routing layer runs on a working thread and pushes the received message to the consumption layer running on the UI thread. Each layer has detailed work, no coupling degree and improved message pushing compatibility and success rate. Therefore, the technical problem that the message pushing rate is low due to the fact that various third-party message pushing platforms are incompatible in the prior art is solved, the technical effects that various pushing platforms are compatible and the message pushing success rate is improved are achieved.

Description

Method and device for realizing message pushing by hierarchical state machine
Technical Field
The invention belongs to the technical field of android television application, and particularly relates to a method and a device for realizing message pushing by a layered state machine.
Background
At present, different from the iOS platform using a unified iOS Cloud pushing scheme, the Android platform also has a large number of third-party pushing platforms, which are well known as follows due to the lack of a unified standard pushing scheme: alliance push (UMPush), aurora push (JPush), GTPush (GTPush), and some manufacturers push (millet push, huaji push, charm push), etc.
The advantage of using the third-party push platform to push messages is that an application developer is not required to repeatedly build a server, and secondly, the third-party push platform has a mature push framework and a data timely processing means. There are also a number of disadvantages to using third party push platforms:
firstly, a third-party push platform cannot be compatible with all machine types, and the problem that the push delivery rate is lower than 80% exists;
secondly, the third-party push platform cannot simultaneously realize on-line (application process survival) and off-line (application process death) message push;
thirdly, the types of messages pushed by a third-party pushing platform are limited, and the increasing multi-type message pushing requirements of the app cannot be met;
finally, once the third-party pushing platform has an operation fault, the app pushing is also in a paralysis state, so that the app activity rate is influenced, and huge economic loss is brought.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for implementing message pushing by a hierarchical state machine, which overcomes or at least partially solves the above problems.
In a first aspect, an embodiment of the present invention provides a method for implementing message pushing by a layered state machine, where the layered state machine includes a receiving layer, an exchange layer, a routing layer, and a consumption layer, and is applied to an android terminal, and the method specifically includes the following steps:
the receiving layer receives messages which are sent by the server and come from different platforms respectively;
the receiving layer transmits the received message to the exchange layer, and the exchange layer and the receiving layer respectively run in two different threads in the same process;
the exchange layer performs unified format conversion on the message and then transmits the message to the routing layer;
and the routing layer runs on a working thread and pushes the received message to the consumption layer running on a UI thread.
With reference to the first aspect, in a first implementation manner of the first aspect, before the receiving layer receives messages sent by the server and respectively sent by different platforms, the method further includes:
the receiving layer establishes long connection communication with the server.
With reference to the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the receiving layer receives messages sent by the server and respectively sent by different platforms, and the receiving layer includes:
when the long connection communication between the server and the receiving layer is in a connection state, the message is directly transmitted to the receiving layer by the server through a socket communication mechanism;
when the long connection communication between the server and the receiving layer is in a disconnected state, the message is forwarded to a system message receiving service by the server instead of being hosted, and after the process of the receiving layer is activated, the system service forwards the message to the receiving layer.
With reference to the first aspect, in a third implementation manner of the first aspect, the passing, by the receiving layer, the received message to the exchange layer includes:
the receiving layer wraps the received message in a service intention and transmits the intention to the exchange layer when the service is started;
the exchange layer receives the intention and then sends a broadcast to the receiving layer to feed back information whether the message is exchanged successfully or not;
and after receiving the information of successful feedback of the exchange layer, the receiving layer randomly starts to transmit the next message.
With reference to the first aspect, in a fourth implementation manner of the first aspect, after receiving the information that the feedback of the exchange layer is successful, the receiving layer randomly starts to transmit a next message, where the transmitting includes:
the messages are transmitted one by one in a queue.
With reference to the first aspect, in a fifth implementation manner of the first aspect, the transmitting, by the exchange layer, the message after performing unified format conversion on the message to the routing layer includes:
and the exchange layer converts the messages in a unified format according to the UMT standard specification and then transmits the messages to the routing layer.
With reference to the first aspect, in a sixth implementation manner of the first aspect, the forwarding a message to a consumption layer running on a UI thread includes:
the routing layer stores the received message in a database and generates a unique query handle;
the routing layer encapsulates the query handle into a message notification, broadcasts are randomly sent after the message notification is activated, the broadcasts are sent out with the query handle, and the consumption layer is waited to receive the broadcasts and read the query handle in the broadcasts;
and the consumption layer reads the query handle, enters a database according to the query handle to query corresponding message data, and creates an action intention according to the message data to perform page switching or message display.
In a second aspect of the present invention, a device for implementing message pushing by a layered state machine is disclosed, where the layered state machine includes a receiving layer, an exchange layer, a routing layer, and a consumption layer, and is applied to an android terminal, and the device includes:
the first receiving module is used for the receiving layer to receive the messages which are sent by the server and respectively come from different platforms;
the first exchange module is used for the receiving layer to transmit the received message to the exchange layer, and the exchange layer and the receiving layer respectively run in two different threads in the same process;
the first conversion module is used for the exchange layer to carry out unified format conversion on the message and then transmit the message to the routing layer;
and the first pushing module is used for the routing layer to run on a working thread and pushing the received message to the consumption layer running on a UI thread.
With reference to the second aspect, in a first implementation manner of the second aspect, the first pushing module includes:
the first storage module is used for storing the received message into a database by the routing layer and generating a unique query handle;
the first encapsulation module is used for encapsulating the query handle into a message notification by the routing layer, randomly sending a broadcast after the message notification is activated, sending the broadcast with the query handle, waiting for the consumption layer to receive the broadcast and reading the query handle in the broadcast;
and the first query module is used for the consumption layer to enter a database to query corresponding message data according to the query handle after reading the query handle, and to establish action intention to perform page switching or message display according to the message data.
In a third aspect of the invention, an electronic device is disclosed, comprising a processor and a memory:
the memory is used for storing a program for executing the method of any one of the above methods,
the processor is configured to execute programs stored in the memory.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages:
the invention discloses a method and a device for realizing message pushing of a layered state machine, wherein the layered state machine comprises a receiving layer, an exchange layer, a routing layer and a consumption layer; secondly, the receiving layer transmits the received message to the exchange layer, and the exchange layer and the receiving layer respectively operate in two different threads in the same process; then, the exchange layer performs unified format conversion on the message and transmits the message to the routing layer; and finally, the routing layer runs in a working thread and pushes the received message to the consumption layer running in a UI thread, so that the final message pushing of a third-party platform is realized through message receiving, data exchange and conversion, all links are not interfered with each other, the message transmission can be carried out on line or off line, various pushing platforms can be compatible, and when one pushing platform is in a fault state, the switching to other available platforms can be carried out. Therefore, the technical problem that the message pushing rate is low due to the fact that various third-party message pushing platforms are incompatible in the prior art is solved, the technical effects that various pushing platforms are compatible and the message pushing success rate is improved are achieved.
Drawings
FIG. 1 shows a flow diagram of a method according to an embodiment of the invention;
FIG. 2 shows a block diagram of an apparatus according to an embodiment of the invention;
fig. 3 shows a block diagram of an apparatus according to another embodiment of the invention.
Detailed Description
The invention provides a method, a device, a method and a device for realizing message pushing by a layered state machine, which are used for solving the technical problem of low message pushing and delivery rate caused by incompatibility of various third-party message pushing platforms in the prior art, and achieving the technical problem of compatibility of various pushing platforms and further improvement of message pushing success rate.
In order to better understand the technical solutions of the present invention, the following detailed descriptions of the technical solutions of the present invention are provided with the accompanying drawings and the specific embodiments, and it should be understood that the specific features in the embodiments and the examples of the present invention are the detailed descriptions of the technical solutions of the present invention, and are not limitations of the technical solutions of the present invention, and the technical features in the embodiments and the examples of the present invention may be combined with each other without conflict.
Referring to fig. 1, the present embodiment provides a method for implementing message pushing by a layered state machine, where the layered state machine includes a receiving layer, an exchange layer, a routing layer, and a consumption layer, and is applied to an android terminal, and the specific method includes the following steps:
and S1, the receiving layer receives the messages sent by the server and respectively from different platforms.
In a specific implementation Process, the receiving layer (Receiver) runs in a Background Process (Background Process), and is essentially a Background Service (Background Service), establishes a communication connection with the message server, and is responsible for receiving various messages sent by the server.
S2, the receiving layer transmits the received message to the exchange layer, and the exchange layer and the receiving layer respectively run in two different threads in the same process.
In a specific implementation, the switching layer (switch) runs in a background process, which is essentially a post-Intent Service (Intent Service) responsible for various messages passed by the receiving layer. The receiving layer and the exchange layer run in the same process, and in order to prevent the receiving layer and the exchange layer from running in the same thread, once the thread is killed, the subsequent operation is terminated, and the receiving layer and the exchange layer run in two different threads respectively, so that the framework system can be compatible and integrated with a plurality of pushing platforms, the plurality of platforms are not interfered with each other, the plurality of platforms are mutually compensated, and even if a single platform fails, the single platform can be switched to other platforms to continue to push messages.
And S3, the exchange layer converts the message into a unified format and then transmits the unified format to the routing layer.
In a specific implementation process, the switching layer (switch) performs format conversion processing on messages of all platforms according to a unified Message specification format (UMT) on various messages transmitted by the receiving layer.
S4, the routing layer runs on a working thread, and the received message is pushed to the consumption layer method running on a UI thread.
In a specific implementation process, a routing layer (Router) and a consumption layer (Consumer) are both located in a main process, except that the routing layer runs in a work Thread (WorkThread) and the consumption layer runs in a UI Thread (UI Thread/MainThread). The routing layer (Router) is essentially a Background Service (Background Service) and is responsible for local persistence (storage) of messages, parsing processing of messages, and batch processing of messages. The consumption layer (Consumer) is essentially a Foreground Service (Foreground Service) that is responsible for message reading and intent processing (IntentHandle) for the final destination of the message.
In the invention, the whole message pushing layered processing framework is divided into 4 layers: a receiving layer, a switching layer, a routing layer and a consuming layer. The flow of passing messages at each level in the whole framework follows: server → receive layer → exchange layer → route layer → consume layer. Each hierarchy has detailed work, no coupling degree exists, and even if a certain hierarchy has problems, the processing of subsequent hierarchies on the message cannot be influenced, so that the success rate of message issuing is improved.
As an optional implementation manner, before the receiving layer receives the messages sent by the server and respectively sent by different platforms in step S1), the method further includes:
the receiving layer establishes long connection communication with the server.
In a specific implementation process, a long Connection (Persistent Connection) refers to a Connection in which a plurality of data packets can be continuously transmitted, and during the Connection maintenance period, if no data packet is transmitted, a link detection packet needs to be transmitted in both directions, so as to avoid packet drop and improve data transmission efficiency.
As an optional implementation manner, in step S1), the receiving layer receives messages sent by the server and respectively sent by different platforms, including:
when the long connection communication between the server and the receiving layer is in a connection state, the message is directly transmitted to the receiving layer by the server through a socket communication mechanism;
when the long connection communication between the server and the receiving layer is in a disconnected state, the message is forwarded to a system message receiving service by the server instead of being hosted, and after the process of the receiving layer is activated, the system service forwards the message to the receiving layer.
In a specific implementation process, when the server establishes long connection communication with the receiving layer, the server issues a message to the receiving layer in 2 situations: one is that the long connection between the server and the receiving layer is in a connection state, and at the moment, the message is directly transmitted to the receiving layer by the server through a socket communication mechanism; the other is that the long connection between the server and the receiving layer is in a disconnected state, at this time, the message is forwarded to the system message receiving service by the server instead of being managed, and after the process of the receiving layer is activated, the system service forwards the message to the receiving layer. Therefore, the transmission of each message is not interfered with each other, the transmission of each message is independently carried out, and the transmission of one message does not influence the transmission of another message.
As an optional implementation manner, step S2) the receiving layer passes the received message to the exchange layer, including:
step S21, the receiving layer wraps the received message in the service intention, and transmits the intention to the exchange layer when the service is started;
step S22, the exchange layer sends broadcast to the receiving layer after receiving the intention, and feeds back the information whether the message is exchanged successfully;
step S23, after the receiving layer receives the information that the feedback of the exchanging layer is successful, it starts to transmit the next message at random.
In the specific implementation process, the receiving layer and the exchange layer are essentially services, in order to realize data exchange between the receiving layer and the exchange layer, the communication between the services is realized by using a service starting mode, message data is wrapped in service intention, the intention is transmitted to the exchange layer when the services are started, the exchange layer sends a broadcast to the receiving layer after receiving the intention transmitted by the receiving layer, and the receiving layer randomly starts to send the next message after receiving the feedback success information of the exchange layer.
As an optional implementation manner, in step S23), after receiving the information that the feedback of the switching layer is successful, the receiving layer randomly starts to deliver the next message, which includes:
the messages are transmitted one by one in a queue.
In a specific implementation process, the messages are transmitted one by one in a queue form, so that the problem of blocking caused by excessive messages is solved.
As an optional implementation manner, step S3) the switching layer performs unified format conversion on the message and then delivers the message to the routing layer, including:
and the exchange layer converts the messages in a unified format according to the UMT standard specification and then transmits the messages to the routing layer.
In a specific implementation process, a switching layer transmits a message to a routing layer to perform notification format conversion of the message, the messages of different platforms are routed to the switching layer in the same route, no preprocessing is performed in the early stage, in order to facilitate local message persistence of a subsequent routing layer and intention processing of a consumption layer, the switching layer performs all format message formatting processing of all platforms to a message of a unified format according to a UMT standard specification, the principle of the UMT standard specification is that message field information of an XML or JSON format is analyzed in an annotation mode, taking a message Id as an example, characters in a field annotation @ bracket represent original field names of a push platform, any one of the field names conforms to { @ (mId), @ (msgId), @ (Id), @ (mId) and @ (messId), the analyzed fields are uniformly named msg _ Id, other message field principles are similar.
TABLE 3-1 Multi-platform message id field Annotation
Ally of friends Millet Huashi Charm family Push away
Field annotation @(mId) @(msgId) @(id) @(msgId) @(messId)
Parsing fields msg_Id msg_Id msg_Id msg_Id msg_Id
As an optional implementation manner, step S4) the routing layer runs on a worker thread, and pushes the received message to the consumption layer running on a UI thread, including:
s41, the routing layer stores the received message in a database and generates a unique query handle;
in a specific implementation process, the routing layer firstly stores the received message in a database to realize local persistence: for example, the message sent by the server is stored in the local database in the JSON format, so that the message is prevented from being lost and messy codes are prevented in the transmission process. And the message is locally persisted before entering the UI thread, so that the message loss caused by the communication among the threads is prevented, and the message delivery rate is improved.
S42, the routing layer encapsulates the query handle into a message notification, broadcasts are sent randomly after the message notification is activated, the broadcasts are sent out with the query handle, and the consumption layer is waited to receive the broadcasts and read the query handle in the broadcasts.
In a specific implementation process, after the routing layer completes local storage of the message, a unique query handle is generated, then the handle is encapsulated in the notification when the message notification is created, a broadcast is sent at random after the notification is clicked, the broadcast is sent out with the query handle, and the consumption layer is waited to receive the broadcast and read the query handle in the broadcast.
And S43, the consumption layer reads the query handle, then enters a database according to the query handle to query corresponding message data, and creates an action intention according to the message data to perform page switching or message display.
In a specific implementation process, after reading the query handle, the consumption layer enters the database according to the query handle to query corresponding message data, and then creates an action intention (Intent) according to the message data to perform page switching or message display. Namely, the consumption layer will do the intent processing: and performing application app business processing according to the intention identification contained in the message, wherein the method comprises the following steps: page switching, message display, etc.
It is specifically noted that the above-mentioned method steps are not necessarily performed in the order of numbering, and thus numbering is merely for convenience of description, and any changes in steps which achieve the objects of the invention are intended to be within the scope of the claims.
Referring to fig. 2, an embodiment of the present invention further provides a device for implementing message pushing by using a layered state machine, where the layered state machine includes a receiving layer, an exchange layer, a routing layer, and a consumption layer, and is applied to an android terminal, and the device includes:
a first receiving module 21, configured to receive, by the receiving layer, messages from different platforms respectively sent by a server;
a first switching module 22, configured to transmit the received message to the switching layer by the receiving layer, where the switching layer and the receiving layer operate in two different threads in the same process respectively;
a first conversion module 23, configured to perform unified format conversion on the message by the exchange layer and transmit the message to the routing layer;
and the first pushing module 24 is configured to push the received message to the consumption layer running on the UI thread when the routing layer runs on a work thread.
As an optional implementation, as shown in fig. 3, the first pushing module further includes:
a first storage module 241, configured to store the received message in a database by the routing layer, and generate a unique query handle;
a first encapsulation module 242, configured to encapsulate the query handle into a message notification by the routing layer, send a broadcast at random after the message notification is activated, where the broadcast is to be sent out with the query handle, and wait for the consumption layer to receive the broadcast and read the query handle in the broadcast;
the first query module 243 is configured to, after the consumption layer reads the query handle, enter a database according to the query handle to query corresponding message data, and create an action intention according to the message data to perform page switching or message display.
An embodiment of the present invention further provides an electronic device, including a processor and a memory:
the memory is used for storing a program for executing the method of any one of the above methods;
the processor is configured to execute programs stored in the memory.
It should be noted that, for the above modules and the specific implementation methods of the functions corresponding to the modules, reference may be made to the specific description of the method embodiment, which is not described herein again.
In the above modules and system embodiments, each included module or module is only divided according to functional logic, but is not limited to the above division as long as the corresponding function can be realized; in addition, the specific names of the functional modules are only for convenience of distinguishing from each other and are not used for limiting the protection scope of the present invention.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages:
the invention discloses a method and a device for realizing message pushing of a layered state machine, wherein the layered state machine comprises a receiving layer, an exchange layer, a routing layer and a consumption layer; secondly, the receiving layer transmits the received message to the exchange layer, and the exchange layer and the receiving layer respectively operate in two different threads in the same process; then, the exchange layer performs unified format conversion on the message and transmits the message to the routing layer; and finally, the routing layer runs in a working thread and pushes the received message to the consumption layer running in a UI thread, so that the final message pushing of a third-party platform is realized through message receiving, data exchange and conversion, all links are not interfered with each other, the message transmission can be carried out on line or off line, various pushing platforms can be compatible, and when one pushing platform is in a fault state, the switching to other available platforms can be carried out. Therefore, the technical problem that the message pushing rate is low due to the fact that various third-party message pushing platforms are incompatible in the prior art is solved, the technical effects that various pushing platforms are compatible and the message pushing success rate is improved are achieved.
Those skilled in the art will appreciate that embodiments of the present invention provide methods in which all or a portion of the steps may be performed by hardware associated with program instructions. Such as may be accomplished by a computer running program. The program may be stored in a readable storage medium, such as a random access memory, a magnetic disk, an optical disk, or the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A method for realizing message pushing by a layered state machine is characterized in that the layered state machine comprises a receiving layer, an exchange layer, a routing layer and a consumption layer, is applied to an android terminal, and comprises the following steps:
the receiving layer receives messages which are sent by the server and come from different platforms respectively;
the receiving layer transmits the received message to the exchange layer, and the exchange layer and the receiving layer respectively run in two different threads in the same process;
the exchange layer performs unified format conversion on the message and then transmits the message to the routing layer;
and the routing layer runs on a working thread and pushes the received message to the consumption layer running on a UI thread.
2. The method of claim 1, wherein before the receiving layer receives messages sent by the server from different platforms, respectively, further comprising:
the receiving layer establishes long connection communication with the server.
3. The method of claim 2, wherein the receiving layer receives messages sent by the server from different platforms, respectively, comprising:
when the long connection communication between the server and the receiving layer is in a connection state, the message is directly transmitted to the receiving layer by the server through a socket communication mechanism;
when the long connection communication between the server and the receiving layer is in a disconnected state, the message is forwarded to a system message receiving service by the server instead of being hosted, and after the process of the receiving layer is activated, the system service forwards the message to the receiving layer.
4. The method of claim 1, wherein the receiving layer passing the received message to the switching layer comprises:
the receiving layer wraps the received message in a service intention and transmits the intention to the exchange layer when the service is started;
the exchange layer receives the intention and then sends a broadcast to the receiving layer to feed back information whether the message is exchanged successfully or not;
and after receiving the information of successful feedback of the exchange layer, the receiving layer randomly starts to transmit the next message.
5. The method of claim 1, wherein the receiving layer receives the information that the feedback of the switching layer is successful and then starts to deliver the next message randomly, comprising:
the messages are transmitted one by one in a queue.
6. The method of claim 1, wherein the message is passed to the routing layer after being uniformly format converted by the switching layer, comprising:
and the exchange layer converts the messages in a unified format according to the UMT standard specification and then transmits the messages to the routing layer.
7. The method of claim 1, wherein the routing layer runs on a worker thread and pushes the received message to the consumption layer running on a UI thread, comprising:
the routing layer stores the received message in a database and generates a unique query handle;
the routing layer encapsulates the query handle into a message notification, broadcasts are randomly sent after the message notification is activated, the broadcasts are sent out with the query handle, and the consumption layer is waited to receive the broadcasts and read the query handle in the broadcasts;
and the consumption layer reads the query handle, enters a database according to the query handle to query corresponding message data, and creates an action intention according to the message data to perform page switching or message display.
8. The utility model provides a hierarchical state machine realizes device of message propelling movement which characterized in that, hierarchical state machine is applied to android terminal including receiving layer, exchange layer, route layer and consumption layer, includes:
the first receiving module is used for the receiving layer to receive the messages which are sent by the server and respectively come from different platforms;
the first exchange module is used for the receiving layer to transmit the received message to the exchange layer, and the exchange layer and the receiving layer respectively run in two different threads in the same process;
the first conversion module is used for the exchange layer to carry out unified format conversion on the message and then transmit the message to the routing layer;
and the first pushing module is used for the routing layer to run on a working thread and pushing the received message to the consumption layer running on a UI thread.
9. The apparatus of claim 8, wherein the first push module comprises:
the first storage module is used for storing the received message into a database by the routing layer and generating a unique query handle;
the first encapsulation module is used for encapsulating the query handle into a message notification by the routing layer, randomly sending a broadcast after the message notification is activated, sending the broadcast with the query handle, waiting for the consumption layer to receive the broadcast and reading the query handle in the broadcast;
and the first query module is used for the consumption layer to enter a database to query corresponding message data according to the query handle after reading the query handle, and to establish action intention to perform page switching or message display according to the message data.
10. An electronic device, comprising a processor and a memory:
the memory for storing a program for performing the method of any one of claims 1 to 7,
the processor is configured to execute programs stored in the memory.
CN201710930050.3A 2017-10-09 2017-10-09 Method and device for realizing message pushing by hierarchical state machine Active CN107741884B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710930050.3A CN107741884B (en) 2017-10-09 2017-10-09 Method and device for realizing message pushing by hierarchical state machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710930050.3A CN107741884B (en) 2017-10-09 2017-10-09 Method and device for realizing message pushing by hierarchical state machine

Publications (2)

Publication Number Publication Date
CN107741884A CN107741884A (en) 2018-02-27
CN107741884B true CN107741884B (en) 2020-10-27

Family

ID=61236739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710930050.3A Active CN107741884B (en) 2017-10-09 2017-10-09 Method and device for realizing message pushing by hierarchical state machine

Country Status (1)

Country Link
CN (1) CN107741884B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108401027B (en) * 2018-02-27 2019-12-06 广州市艾发信息技术有限公司 Intelligent transportation software unified management system based on cloud computing
CN110297707A (en) * 2018-03-22 2019-10-01 香港乐蜜有限公司 A kind of method for message transmission and device
CN108964971A (en) * 2018-05-23 2018-12-07 国政通科技股份有限公司 A kind of data interchange platform
CN110233883A (en) * 2019-05-24 2019-09-13 中国平安人寿保险股份有限公司 Processing method, device, server and the storage medium of PUSH message
CN115412523B (en) * 2021-05-28 2024-02-06 阿里巴巴新加坡控股有限公司 Message processing method and device

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8301780B2 (en) * 2006-09-26 2012-10-30 Nextel Communications, Inc. Client-based solution for seamless access to applications across networks
CN100470488C (en) * 2007-06-26 2009-03-18 北京邮电大学 Method for realizing unified universal message bus between different assembly process
US8554855B1 (en) * 2011-06-14 2013-10-08 Urban Airship, Inc. Push notification delivery system
US8634810B2 (en) * 2011-09-29 2014-01-21 International Business Machines Corporation Pushing secure notifications to mobile computing devices
CN103731802A (en) * 2012-10-12 2014-04-16 上海宝信软件股份有限公司 Device management method based on Android mobile terminal
CN103973718A (en) * 2013-01-25 2014-08-06 成都勤智数码科技股份有限公司 Operation and maintenance message pushing method based on android mobile platform
CN103856392B (en) * 2013-06-26 2017-05-24 上海携程商务有限公司 Message push method, outgoing server using message push method and outgoing server system
CN103778228B (en) * 2014-01-24 2018-02-23 五八同城信息技术有限公司 The method that biographic information orientation popularization is realized using instant communicating system
CN104753769A (en) * 2015-03-24 2015-07-01 新余兴邦信息产业有限公司 Method and device for issuing messages by message queue
CN105005201A (en) * 2015-06-04 2015-10-28 广东康宝电器股份有限公司 Multi-mobile-terminal data synchronization and push system for intelligent household
CN105246054A (en) * 2015-08-27 2016-01-13 武汉诚迈科技有限公司 Message push method suitable for android smart phone
CN105978795A (en) * 2016-06-22 2016-09-28 安徽广行物联科技有限公司 Mobile message double-platform, multi-terminal and multi-application pushing method
CN106203075A (en) * 2016-07-19 2016-12-07 北京珠穆朗玛移动通信有限公司 A kind of method and device preventing application program from waking up up mutually
CN107193674B (en) * 2017-06-29 2020-01-03 武汉斗鱼网络科技有限公司 Method and device for processing online push message

Also Published As

Publication number Publication date
CN107741884A (en) 2018-02-27

Similar Documents

Publication Publication Date Title
CN107741884B (en) Method and device for realizing message pushing by hierarchical state machine
CN102377685B (en) Subscription message sending system and subscription message sending method
GB2589211A (en) Methods and systems of using remote subscriber identification modules at device
CN102761864A (en) Data transmission method, system and device
CN112788074B (en) Data transmitting method, processing method, receiving method, apparatus thereof, and storage medium
CN102945169A (en) Native APP fused Web APP development system based on Android
CN103428072B (en) A kind of dissemination method of persistent message and system
CN103746959B (en) The implementation method of the communication mechanism of Java modules and C modules under OSGi environment
CN110535889B (en) Internet of things interaction system
WO2022120806A1 (en) Multi-cloud distributed messaging method and system for high performance computing
CN102158482A (en) JSON (JavaScript Object Notation) data protocol based passenger transport information communication method and system
CN103440142A (en) GPRS (General Packet Radio Service)-based remote upgrade and dynamic loading method
CN101977362A (en) Short message group sending method and system
CN104852991A (en) Distributed push server system and data push method using the system
CN101222437B (en) Method and system for transparent transmission of BPDU packet in two-layer switching network
CN104539510A (en) Multi-protocol-based information pushing system and method
CN112527523A (en) Distributed message transmission method and system for high-performance computing multiple clouds
CN103699450A (en) Linux adaptive component communication method
CN104486330A (en) Two-way communication system based on remote procedure calls (RPCs)
CN102299862A (en) Quick forwarding equipment and method for two-layer tunnel
CN101626348B (en) System and method for realizing service support of enterprise convergence communication
CN105933216A (en) Pig farm message management system
CN108614820B (en) Method and device for realizing streaming source data analysis
CN104243483A (en) Message processing method and message processing equipment
CN109639545B (en) Lightweight bus arrangement method of multi-satellite measurement and control platform system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant