WO2021087892A1 - 资源的订阅方法、设备及存储介质 - Google Patents
资源的订阅方法、设备及存储介质 Download PDFInfo
- Publication number
- WO2021087892A1 WO2021087892A1 PCT/CN2019/116354 CN2019116354W WO2021087892A1 WO 2021087892 A1 WO2021087892 A1 WO 2021087892A1 CN 2019116354 W CN2019116354 W CN 2019116354W WO 2021087892 A1 WO2021087892 A1 WO 2021087892A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- resource
- version
- target resource
- subscription
- request
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 112
- 230000008569 process Effects 0.000 claims abstract description 18
- 230000004044 response Effects 0.000 claims description 96
- 230000015654 memory Effects 0.000 claims description 31
- 238000004891 communication Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 description 19
- 238000010586 diagram Methods 0.000 description 10
- 238000004590 computer program Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000011664 signaling Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000007423 decrease Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/542—Event management; Broadcasting; Multicasting; Notifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/10—Office automation; Time management
- G06Q10/101—Collaborative creation, e.g. joint development of products or services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
Definitions
- the embodiments of the present application relate to communication technologies, and in particular, to a resource subscription method, device, and storage medium.
- the subscription device (as the client) sends a subscription request to the subscription target device (as the server).
- the subscription request may include the identity of the subscription content, the identity of the subscription device, the subscription identity, and the request identity, etc.
- the subscription target device receives the subscription request, authenticates the subscription request and starts to monitor whether the subscription content has changed, and the subscription target device also returns a subscription request response to the subscription device.
- the subscription target device detects that the subscription content changes, it sends a notification message to the subscription device, and the notification message includes the updated subscription content.
- the subscription device may not receive the updated subscription content sent by the target subscription device, causing the user to lose the key subscription content.
- the embodiments of the present application provide a resource subscription method, device, and storage medium, which can ensure that the resource subscribed by the user is not lost.
- an embodiment of the present application may provide a resource subscription method, which is applied to a subscription device, and the method includes:
- the locally stored second version number of the target resource, and the version number generation rule it is determined whether the version of the target resource is missing, wherein one of the version numbers generated according to the generation rule There is an association relationship between them, the generation rules of the version number used by the subscription device and the resource collection device are the same, and the second version number is the current version number of the target resource stored on the subscription device;
- the version of the target resource is missing, obtaining the missing version of the target resource from the resource collection device, and updating the second version number according to the resource update message;
- embodiments of the present application may provide a resource subscription method, which is applied to a resource collection device, and the method includes:
- a new version number is generated for the target resource according to the generation rule of the version number and the current version number of the target resource stored locally, and the current version number of the target resource is changed. Update to the new version number, wherein the version numbers generated according to the generation rule have an association relationship;
- the resource update message including the first version number of the target resource and the update content of the target resource, and the first version number is the The current version number of the target resource.
- embodiments of the present application may provide a resource collection device, including:
- the receiving module is configured to receive a resource update message sent by a resource collection device, where the resource update message includes the update content of the subscribed target resource and the first version number of the target resource, where the first version number is the resource The current version number of the target resource stored on the collective device;
- the determining module is configured to determine whether the version of the target resource is lost according to the first version number, the locally stored second version number of the target resource, and the generation rule of the version number, wherein, according to the generation rule
- the generated version numbers have an association relationship, the generation rules of the version numbers used by the subscription device and the resource collection device are the same, and the second version number is the current version of the target resource stored on the subscription device number;
- the first obtaining module is configured to obtain the missing version of the target resource from the resource collection device when the version of the target resource is missing;
- the update module is configured to update the second version number according to the resource update message.
- embodiments of the present application may provide a resource collection device, including:
- the generation module is used to generate a new version number for the target resource according to the generation rule of the version number and the current version number of the target resource stored locally when it is detected that the target resource is updated, wherein There is an association relationship between the version numbers generated by the above generation rules;
- the update module is used to update the current version number of the target resource to the new version number
- a sending module configured to send a resource update message to a subscribing device, the resource update message including the first version number of the target resource and the update content of the target resource, and the first version number is the resource subscribing device The current version number of the target resource stored on the.
- embodiments of the present application may provide a subscription device, including:
- the memory stores computer execution instructions
- the processor executes the computer-executable instructions stored in the memory, so that the processor executes the resource subscription method as described in the first aspect.
- embodiments of the present application may provide a resource collection device, including:
- the memory stores computer execution instructions
- the processor executes the computer-executable instructions stored in the memory, so that the processor executes the resource subscription method as described in the second aspect.
- the embodiments of the present application may provide a computer-readable storage medium having computer-executable instructions stored in the computer-readable storage medium.
- the computer-executable instructions are executed by a processor, the The subscription method of the resource.
- an embodiment of the present application may provide a computer-readable storage medium having a computer-executable instruction stored in the computer-readable storage medium, and when the computer-executable instruction is executed by a processor, it is used to implement the second aspect The subscription method of the resource.
- an embodiment of the present application provides a program, when the program is executed by a processor, it is used to execute the resource subscription method described in the first aspect above.
- an embodiment of the present application provides a program, when the program is executed by a processor, it is used to execute the resource subscription method described in the second aspect above.
- an embodiment of the present application provides a computer program product, including program instructions, which are used to implement the resource subscription method described in the first aspect.
- an embodiment of the present application provides a computer program product, including program instructions, and the program instructions are used to implement the resource subscription method described in the second aspect.
- an embodiment of the present application provides a chip, which includes a processing module and a communication interface, and the processing module can execute the resource subscription method described in the first aspect.
- the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to perform the first aspect.
- a storage module such as a memory
- the storage module is used to store instructions
- the processing module is used to execute the instructions stored in the storage module
- the execution of the instructions stored in the storage module causes the processing module to perform the first aspect.
- the subscription method of the resource such as a memory
- an embodiment of the present application provides a chip, including a processing module and a communication interface, and the processing module can execute the resource subscription method described in the second aspect.
- the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute the second aspect The subscription method of the resource.
- a storage module such as a memory
- the storage module is used to store instructions
- the processing module is used to execute the instructions stored in the storage module
- the execution of the instructions stored in the storage module causes the processing module to execute the second aspect The subscription method of the resource.
- the embodiment of the application provides a resource subscription method, device, and storage medium.
- the subscription device and the resource collection device maintain a current version number for the subscription resource.
- the version number of the subscription resource is generated according to the version number generation rule. There is an association relationship between the version numbers generated by the generation rules.
- the subscription device can determine whether there is a version according to the current version number of the subscription resource sent by the resource collection device, the version number of the subscription resource saved locally, and the generation rule. Lost. And one or more versions prior to the current version of the target resource are stored in the resource collection device. When a version is lost, the subscription device can request the missing version from the resource collection device, thereby ensuring that the user will not lose the subscription resource.
- FIG. 1 is a schematic diagram of a network architecture to which an embodiment of this application is applicable;
- FIG. 3 is a signaling flowchart of the resource subscription method provided in the second embodiment of the application.
- FIG. 4 is a schematic structural diagram of a subscription device provided in Embodiment 3 of this application.
- FIG. 5 is a schematic structural diagram of a resource collection device provided in Embodiment 4 of this application.
- FIG. 6 is a schematic structural diagram of a subscription device provided in Embodiment 5 of this application.
- FIG. 7 is a schematic structural diagram of a resource collection device provided in Embodiment 6 of this application.
- FIG. 1 is a schematic diagram of a network architecture to which the embodiments of this application are applicable.
- the network architecture at least includes: a subscription device 11 and a resource collection device 12, and the subscription device 11 and the resource collection device 12 can pass through Wired or wireless connection and communication. It is understandable that in actual network deployment, there may be one or more subscription devices 11 and resource collection devices 12, and FIG. 1 only uses one as an example.
- the subscription device 101 is a mobile phone as an example. It can be understood that the subscription device 101 is not limited to a mobile phone, and may also be an electronic device such as a computer, a smart TV, and a game console.
- the subscription device 11 and the resource collection device 12 may communicate in a client/server (client/server, referred to as CS) mode, where the subscription device 11 serves as a client and the resource collection device 12 serves as a server.
- the resource collection device 12 is used to provide and manage resources for the subscription device 11.
- the subscription device 11 may be a target resource from the resource collection device 12, and the resource collection device pushes resources to the subscription device 11 according to the content subscribed by the subscription device.
- the subscription device 11 can be a smart phone, a computer, a smart TV and other control devices used to control smart home appliances.
- the subscription device 11 can be installed through an application ( app) to control smart home appliances, which can be smart desk lamps, smart speakers, and smart air conditioners.
- the resource management device 12 manages the resources provided by the smart home appliances, and the resources may be the functions of the smart home appliances.
- the resources in the resource management device 12 include: the switch resource of the smart desk lamp, the brightness resource of the smart desk lamp, and the status of the smart desk lamp. Color resource, or switch resource of smart air conditioner, mode resource of smart air conditioner, temperature resource of smart air conditioner, wind speed resource of smart air conditioner, etc.
- an app that controls the smart air conditioner is installed on the smart phone.
- the user can subscribe to the switch resource and temperature resource of the smart air conditioner through the app.
- the resource collection device 12 sends resources to the smart phone according to the resource subscribed by the user. Information.
- the resource collection device 12 manages multiple resources, and the resources are distinguished by unique resource identifiers.
- the resource collection device 12 can manage the resources of one or more smart home appliances.
- the resource collection device A only manages various resources of the smart air conditioner.
- the resource collection device B only manages the various resources of the smart refrigerator, and the resource collection device C can manage various resources of the smart lamp.
- the resources of multiple smart home appliances of the same manufacturer are managed by a resource collection device.
- resource collection device A manages the resources of smart home appliances of manufacturer A
- resource collection B manages the resources of smart home appliances of manufacturer B .
- the resource collection device sends a resource update message to the subscribing device to update the resource, but the resource update message sent by the resource collection device may be lost , Which may cause users to miss important information.
- a version number is defined for each resource.
- a new version number is regenerated for the resource according to the generation rule of the version number of the resource.
- the version numbers generated by the rules have an association relationship, and the version content corresponding to different version numbers of the same resource is different.
- the resource collection device carries the current version number of the resource in a resource update message and sends it to the subscribing device.
- the subscribing device uses the version number generation rule, the current version number of the resource stored locally, and the resource update message.
- the current version number of the resource included can determine whether the version of the resource is missing.
- the subscribing device can be based on the received current version number and the locally stored version number.
- the version number determines whether any version is missing. Then, according to the version number of the missing version, request the missing version from the resource collection device, so as to ensure that the user will not lose the subscription resource.
- the version number of the target resource is used to uniquely identify the version of a target resource, and the version of the target resource refers to the information or content of the target resource. Or, for the target resource information of a certain version, the version number of the target resource refers to the version number of a certain version of the target resource.
- Embodiment 1 of this application provides a resource subscription method.
- Figure 2 is a signaling flowchart of the resource subscription method provided in Embodiment 1 of this application. As shown in Figure 2, this embodiment The method provided in the example includes the following steps:
- the subscribing device sends a subscription request to the resource collection device, where the subscription request is used to request subscription to a target resource.
- the message type of the subscription request may be Retrieve, and the subscription request includes the following information: the identification of the subscription device, the identification of the target resource, the request identification, the operation type, and the identification of the resource collection device.
- the subscription device refers to the device where the client with the subscription function is installed, and the identity of the subscription device refers to the device that installs the client.
- the identification of the electronic device refers to the device where the client with the subscription function is installed.
- the request identifier is used to complete the binding of the request and response (or called response).
- the relevant response message returned by the resource collection device to the subscribing device includes the request identifier, so that the subscribing device can confirm The relationship between the messages.
- the operation type represents the operation of the subscription request on the resource, generally CURDN.
- CURDN is the abbreviation of Create, Update, Retrieve, Delete, and Notify.
- CURDN is also called rest operation. Types of.
- the subscription request further includes a subscription identifier, which is used to uniquely identify a subscription relationship, and a subscription relationship is composed of a subscription device, a subscribed resource, and a resource collection device.
- a subscription relationship is composed of a subscription device, a subscribed resource, and a resource collection device.
- Subsequent messages exchanged between the subscription device and the resource collection device may carry the subscription identifier, and the subscription device and the resource collection device can determine the subscription relationship according to the subscription identifier.
- the subscribing device and the resource collection device jointly determine the subscription based on the subscribed device identifier, the subscribed resource identifier, and the resource collection device identifier included in the message. relationship.
- the subscription request may also include first indication information, which is used to indicate whether to set the version number for the target resource. If the first indication information indicates that the version number is set for the target resource, follow this embodiment of the application. If the first indication information indicates that it is not the version number of the target resource device, the subscribing device does not generate a version number for the target resource, and the resource subscription is performed in a traditional manner.
- the default value of tagflag is false or true, and the user can choose whether to set the version number for the target resource before subscribing to the resource. If the user does not choose, the default value of tagflag is carried in the subscription request.
- the resource collection device After the resource collection device receives the subscription request, in one manner, if the first indication information indicates that the version number is set for the target resource, the resource collection device sets the version number for the target resource, and if the first indication information indicates that the version number is not set for the target resource Number, the resource collection device does not set a version number for the target resource. In another manner, the resource collection device determines whether to set a version number for the target resource according to the first indication information and its own selection strategy.
- the selection strategy may be, for example, that some subscribed devices support the method of setting the version number for the target resource, while the other part of the subscribed devices does not support the method of setting the version number for the target resource.
- the subscribed device can be divided according to the type of the subscribed device or the subscribed device The priority or other parameter divisions are not limited in this embodiment.
- the subscription request does not carry the first indication information, but carries the capability information of the subscribing device.
- the capability information of the subscribing device indicates whether the subscribing device supports the method of setting the version number for the target resource.
- the resource subscribing device can be based on the subscribed device The capability information determines whether to set the version number for the target resource.
- an attribute information can also be set in the resource collection device, and the attribute information is used to indicate whether the resource collection device supports the method of setting the version number for the target resource.
- the subscribing device can actively query the resource collection device whether the resource collection device is The method of setting the version number for the target resource is supported, and the resource collection device can also actively notify the subscribing device whether it supports the method of setting the version number for the target resource.
- the subscription request may not carry the first indication information and the capability information of the subscription device, and the resource collection device determines whether it is the target resource device version number according to the above-mentioned selection strategy.
- multiple subscription devices may subscribe to the same resource, that is, there are multiple subscription relationships for the same resource.
- there are three members in a family and all three members can subscribe to the same resource, such as the temperature resource of the air conditioner. All three members use their mobile phones to subscribe to the temperature resource of the air conditioner, that is, the subscription devices are different.
- the subscription devices of the three subscription relationships are different, but the subscribed resources and resource collection devices are the same.
- the multiple subscription relationships correspond to a version number of the target resource, that is, the target resource has the same version number in the multiple correspondence relationships.
- each subscription relationship in the multiple subscription relationships corresponds to a version number of the target resource, and the multiple subscription relationships correspond to different version numbers of the target resource.
- the subscription request in this application refers to any message that can realize the request for subscribing to the target resource.
- the name of the subscription request may be different with the evolution of the network or the change of the scene. This application is only an example for illustration and does not constitute a limitation.
- Subscription request can also be replaced with subscription message, subscription request message, resource subscription request, etc.
- the resource collection device records the subscription relationship, starts to monitor the target resource, and checks the current version number of the target resource.
- the resource collection device After receiving the subscription request, the resource collection device records the subscription relationship according to the identification of the subscription device, the identification of the target resource, and the identification of the subscription device included in the subscription request. If the subscription request includes a subscription identifier, the corresponding relationship between the subscription identifier and the subscription relationship is also recorded.
- the current version number of the target resource can be stored in a type of resource information newly defined in the embodiment of this application.
- the resource information of this type can include: the current version number (current tag), the version list (taglist), and the target resource identifier ( targetresourceID), the identification of the subscription device (orginaldeviceID), and the subscription type (subscribetype).
- the current version number is the latest version number of the target resource.
- the resource collection device continuously monitors the target resource. When the target resource changes, it generates a new version number for the target resource according to the preset version number generation rule, and the current version number Update to the new version number, and each time the target resource changes, the resource collection device will update the current version number of the target resource.
- the version list includes the current version of the target resource and the content of one or more versions earlier than the current version.
- the subscribing device can request the missing version from the version list. version.
- all versions of the target resource are included in the version list.
- the versions included in the version list are the current version of the target resource and the N versions closest to the update time of the current version, and the value of N is greater than or equal to 1, for example, the value of N is 3 or 5.
- the 3 versions closest to the update time of the current version are: the 7th-9th version, so the target is saved in the version list Version 7-9 of the resource.
- the version list is continuously updated with the current version number of the target resource. For example, the current version of the target resource at the current moment is the 10th version. After a period of time, the current version of the target resource is updated to the 11th version. Then the resource collection device correspondingly moves the 7th version out of the version list, and adds the 10th version to the version list.
- the version in the version list is the current version and the version whose update time is within a preset time from the current time.
- the version list stores the version that was updated within 1 hour from the current time. Versions, earlier versions have been deleted.
- each time the version of the target resource is updated the version before the update is added to the version list, and a timer is started for the version, and after the timer expires, the version delete.
- Each version in the version list has a timer. After the timer expires, the corresponding version is deleted.
- Subscription types can include creation, addition, deletion, and modification.
- the resource information may also include a subscription ID (subscribeID) or other information.
- subscribeID subscription ID
- the resource collection device sends a response to the subscription request to the subscription device, and the response to the subscription request includes the current version number of the target resource.
- the response to the subscription request is used to notify the subscription device.
- the resource collection device receives the subscription request. After the subscription device receives the response to the subscription request, it obtains the current version number of the target resource from the response to the subscription request, and saves the current version of the target resource number.
- the response of the subscription request may include a request identifier, the request identifier included in the response of the subscription request is the same as the request identifier included in the subscription request, and the subscription device determines the relationship between the response of the subscription request and the subscription request according to the request identifier.
- the subscribing device may also maintain the same resource information as the resource collection device for maintaining the current version number of the target resource.
- the resource collection device will synchronize the updated target resource with the subscribing device, thereby ensuring that the current version of the target resource maintained by the subscribing device and the resource collection device is consistent.
- the resource information maintained by the subscription device and the resource information maintained by the resource collection device may also be different.
- the resource information maintained by the subscription device is missing the version list, or the subscription device The maintained resource information does not include the subscription identifier.
- the subscription device obtains the current version number of the target resource from the resource collection device during the process of establishing a subscription relationship with the resource collection device, and the current version number of the target resource acquired during the establishment of the subscription relationship is the initial version of the target resource number.
- Steps S101-S103 describe a way to establish a subscription relationship: the subscription device sends a subscription request to the resource collection device, the resource collection device returns a response to the subscription request to the subscription device, and the subscription device establishes the subscription relationship according to the response to the subscription request.
- the establishment of the subscription relationship may also include more message interactions, which is not limited in this embodiment.
- the resource collection device When it is detected that the target resource is updated, the resource collection device generates a new version number for the target resource according to the version number generation rule, and updates the current version number of the target resource stored locally to the new version number, where , The version numbers generated according to the generation rule have an association relationship.
- the current version number of the target resource stored locally by the resource collection device refers to the current version number stored in the resource collection device.
- the current version number of the target resource is stored in the resource collection device and the subscription device, respectively.
- the generation rule is a rule commonly used by the subscription device and the resource collection device.
- the subscription device and the resource collection device can negotiate the generation rule to be used in advance, or the generation rule is preset in the client of the subscribing device and the resource collection device, and The subscription device and resource collection device can be notified by other devices.
- the version numbers generated according to the generation rule have an association relationship. For example, the version number of the target resource increases from small to large, or the version number of the target resource decreases from large to small, where the step size of each increase or decrease is A fixed value.
- the version number can also be recycled. For example, if the version number is 0-99, the initial value of the current version number of the target resource is 0. Whenever the target resource is updated, the current version number is increased by 1, when the version number of the target resource is 0 After increasing to 99, re-assign the version number from 0.
- the resource collection device Assuming that the current version number of the target resource at T0 is 21, it is monitored at T1 (time T1 is later than T0) that the target resource is updated, the resource collection device generates a new version number 22 for the target resource, and the current version number of the target resource Update to 22.
- the resource collection device sends a resource update message to the subscribing device.
- the resource update message includes the first version number of the target resource and the update content of the target resource.
- the first version number is the current version number of the target resource stored on the resource subscribing device.
- the first version number is the latest version number of the target resource, and the resource collection device sends the updated content to the subscribing device through a resource update message.
- the embodiment of the application does not limit the resource update message, as long as the message can achieve similar functions, it can be called a resource update message.
- the name of the resource update message is not limited, and can also be called a notification message, an update message, or other messages.
- the subscribing device determines whether the version of the target resource is missing according to the first version number included in the resource update message, the second version number of the target resource stored locally, and the version number generation rule.
- the version numbers generated according to the generation rule have an association relationship
- the generation rules of the version numbers used by the subscription device and the resource collection device are the same
- the second version number is the current version number of the target resource stored on the subscription device.
- the subscribing device and the resource collection device maintain a current version number for the target device respectively. It is assumed that the subscribing device and the resource collection device complete the resource update without the loss of resource update messages. It is the same as the current version of the target resource stored on the resource collection device.
- the subscription device can determine that the resource update message includes in the next resource update according to the current version of the subscription resource stored locally and the generation rule Version number.
- the subscription device can determine the version number of the target resource after the resource update according to the locally stored second version number of the target resource and the version number generation rule, and will determine the version number of the target resource after the resource update and the resource update.
- the first version number included in the message is compared, and if the two are the same, it is determined that the version of the target resource is not lost, and if the two are not the same, it is determined that the version of the target resource is lost.
- the second version number of the target resource stored on the subscription device is 7, and the generation rule is to add 1 to the previous version number.
- the subscription device can determine the target resource after this resource update according to the second version number and the generation rule.
- the version number of is 8, but the first version number in the resource update message is 9. If no version is missing, the version number of the target resource after the local update determined by the subscribing device should be the same as the first version number, and the two are not the same. Some versions are missing. According to the generation rules, it can be known that the version with version number 8 is missing.
- step S107 In the case that the version of the target resource is missing, step S107 is executed, and in the case that the version of the target resource is not lost, step S108 is executed.
- the subscribing device obtains the missing version of the target resource from the resource collection device.
- Step S107 is an optional step. If the version of the target resource is not lost, S107 is not executed, and S108 is directly executed to modify the second version number.
- the subscribing device can not only determine the missing version, but also determine the version number of the missing version, and then request the target from the resource collection device based on the version number of the missing version of the target resource The missing version of the resource.
- the subscription device sends a first request to the resource collection device, the first request is for requesting the missing version of the target resource, the first request includes the version number of the missing version of the target resource, and the first request is received from the resource collection device.
- the resource collection device After the resource collection device receives the first request, according to the version number of the lost version, find whether the missing version exists from the version of the target resource stored locally. If the lost version is still stored in the resource collection device, the resource collection device will be lost The version is carried in the response of the first request and sent to the subscribing device. If the missing version has been deleted from the resource device, the resource collection device can return a request failure response to the subscribing device, and the request failure response can be carried in the response of the first request in.
- the resource collection device can maintain a version list, which includes the content and version number of one or more versions before the current version of the target resource. After the resource collection device receives the first request, it queries whether it exists from the version list The version number of the missing version.
- the subscribing device can request the missing version from the resource collection device through multiple first requests, and each first request includes only one missing version. Version number.
- the subscribing device can also carry the version numbers of multiple missing versions in the first request.
- the resource collection device can send multiple missing versions to the subscribing device through one response message, and the resource collection device can also send multiple missing versions through multiple response messages.
- One missing version is sent to the subscribing device, where each response message carries one missing version.
- the resource collection device may only store some of the missing versions. In this case, the resource collection device only sends the stored missing version to the subscribing device.
- the subscribing device before sending the first request to the resource collection device, sends a second request to the resource collection device, and the second request is used to confirm whether a missing version of the target resource is stored on the resource collection device.
- the request includes the version number of the missing version of the target resource, and the response of the second request is received from the resource collection device.
- the response of the second request is used to notify whether the missing version of the target resource is stored on the resource collection device.
- the first request is sent to the resource collection device.
- the resource collection device After the resource collection device receives the second request, it queries the version list for the version number of the missing version. If the version number of the missing version exists in the version list, it is determined that the resource collection device stores the missing version of the target resource. If the version list is If there is no version number of the missing version in the resource set, it is determined that the missing version of the target resource is not stored in the resource collection, and there may only be version numbers of part of the missing version in the version list.
- one or more bits can be used to indicate whether the missing version of the target resource is stored on the resource collection device. Taking one bit as an example, when the value of this bit is 1, it means that the resource collection device is stored on the resource collection device. There is a missing version of the target resource. When the value of this bit is 0, it means that the missing version of the target resource is not stored on the resource collection device.
- the first request returns Including the identification information of the subscription relationship
- the subscription device obtains the missing version from the resource collection device through the version number of the missing version and the identification information of the subscription relationship.
- the subscribing device updates the second version number according to the resource update message.
- the subscribing device After receiving the resource update message, the subscribing device updates the second version number to the first version number included in the resource update message. After the update is completed, the current version number of the target resource stored on the subscribing device and the resource collection device is the same.
- the subscription device and the resource collection device respectively maintain a current version number for the subscription resource.
- the version number of the subscription resource is generated according to the version number generation rule, and the version numbers generated according to the generation rule have an association relationship.
- the subscription device can determine whether there is a version loss according to the current version number of the subscription resource sent by the resource collection device, the version number of the subscription resource stored locally, and the generation rule. And one or more versions prior to the current version of the target resource are stored in the resource collection device. When a version is lost, the subscription device can request the missing version from the resource collection device, thereby ensuring that the user will not lose the subscription resource.
- Fig. 3 is a signaling flow chart of the resource subscription method provided in the second embodiment of the application.
- the method of this embodiment is based on the method shown in Fig. 2, after the subscribing device receives the resource update message , Send a response message to the resource collection device, and if the resource collection device does not receive the response message of the resource update message, it will resend the resource update message.
- the method provided in this embodiment includes the following steps:
- the subscription device sends a subscription request to the resource collection device, where the subscription request is used to request subscription to the target resource.
- the resource collection device records the subscription relationship, starts to monitor the target resource, and checks the current version number of the target resource.
- the resource collection device sends a response to the subscription request to the subscription device, where the response to the subscription request includes the current version number of the target resource.
- the resource collection device When it is detected that the target resource is updated, the resource collection device generates a new version number for the target resource according to the version number generation rule, and updates the current version number of the target resource stored locally to the new version number.
- the version numbers generated according to the generation rule have an association relationship, and the generation rules used by the resource collection device and the subscription device for the target resource are the same.
- the resource collection device sends a resource update message to the subscribing device.
- the resource update message includes the first version number of the target resource and the update content of the target resource.
- the first version number is the current version number of the target resource stored on the resource subscribing device.
- steps S201-S205 please refer to the first embodiment S101-105, which will not be repeated here.
- the subscribing device sends a resource update message response to the resource collection device.
- the response of the resource update message is used to confirm that the subscribing device has received the resource update message, and the response of the subscription update message may include the current version number of the target resource and the identifier of the target resource.
- the response to the resource update message may also include the identification information of the subscription type and/or the subscription relationship.
- the identification information of the subscription relationship may be the subscription identification, and the identification information of the subscription relationship may also be the identification of the subscribing device and the subscription resource.
- the identification and the identification composition of the resource collection device may also include the identification information of the subscription type and/or the subscription relationship.
- the resource collection device After sending the resource update message, if a response to the resource update message is not received within a preset time, the resource collection device resends the resource update message to the subscribing device.
- Step S207 is an optional step. If the resource collection device receives a response to the resource update message within the preset time, this step is not executed, that is, the resource update message will not be retransmitted.
- the resource collection device After the resource collection device sends a resource update message, it can start a timer. If it does not receive a response to the resource update message before the timer expires, it retransmits the resource update message. If the resource update message is received before the timer expires In response to the update message, it is determined that the subscribing device has received the resource update message.
- the resource collection device may not receive the resource update message response in the following two situations: the resource update message is lost, the subscribing device does not receive the resource update message, and naturally will not send a response to the resource update message; the subscribing device receives the resource update Message, and the response to the resource update message was sent, but the response to the resource update message was lost. In the above two cases, the resource collection device will resend the resource update message to the subscribing device.
- step S207 in the figure does not represent a step, but a retransmission process.
- One or more retransmissions can be performed during the retransmission process.
- the resource collection device can set a maximum number of retransmissions K, K The value is 3 or 4, for example. When the preset maximum number of retransmissions is reached or when it is confirmed that the subscribing device has received the retransmitted resource update message, stop resending the resource update message to the subscribing device.
- the resource collection device After the resource collection device retransmits the resource update message each time, if the subscribing device receives the retransmitted resource update message, the subscribing device will return the resource update message response to the resource collection device. After the resource collection device receives the resource update message response, It is determined that the retransmission of the resource update message is successful, and the retransmission of the resource update message is stopped.
- the resource collection device may successfully retransmit the resource update message through one or more retransmissions. If the resource collection device retransmits successfully after one retransmission, subsequent retransmissions will not be performed. If after one retransmission, within a specified time If a response to the retransmitted resource update message is not received, it is determined that this retransmission has failed, and the next retransmission is performed. Only after the retransmission is successful or the number of retransmissions reaches the maximum value K, the retransmission operation is stopped.
- the subscribing device determines whether the version of the target resource is missing according to the first version number included in the resource update message, the second version number of the target resource stored locally, and the version number generation rule.
- the resource update message in this step may be a resource update message retransmitted by the resource collection device, or it may be a resource update message initially transmitted by the resource collection device. If the version of the target resource is missing, step S209 is executed, and if the version of the target resource is not lost, step S210 is executed.
- the subscribing device obtains the missing version of the target resource from the resource collection device.
- the subscribing device updates the second version number according to the resource update message.
- the subscribing device after receiving the resource update message, the subscribing device will return a response to the resource update message to the resource collection device.
- the resource collection device can determine whether the resource update message is lost in a timely manner according to the response of the resource update message. When a message is lost, the resource update message is retransmitted to ensure that the user can obtain the lost version in time. Even if the retransmission is not successful, the subscription device can find the missing version according to the version number of the subscription resource when the subscription resource is updated next time, and then obtain the lost version from the resource collection device to ensure that the user will not lose the subscription resource.
- FIG. 4 is a schematic structural diagram of a subscription device provided in Embodiment 3 of this application. As shown in FIG. 4, the method provided in this embodiment of the subscription device 100 includes:
- the receiving module 11 is configured to receive a resource update message sent by a resource collection device, where the resource update message includes the update content of the subscribed target resource and the first version number of the target resource, and the first version number is the The current version number of the target resource stored on the resource collection device;
- the determining module 12 is configured to determine whether the version of the target resource is missing according to the first version number, the second version number of the target resource stored locally, and the version number generation rule, wherein, according to the generation There is an association relationship between the version numbers generated by the rules, the generation rules of the version numbers used by the subscription device and the resource collection device are the same, and the second version number is the current value of the target resource stored on the subscription device. version number;
- the first obtaining module 13 is configured to obtain the missing version of the target resource from the resource collection device when the version of the target resource is missing;
- the update module 14 is configured to update the second version number according to the resource update message.
- the subscription device 100 further includes: a second acquisition module, configured to: before the receiving module receives the resource update message sent by the resource collection device, in the process of establishing a subscription relationship with the resource collection device, from the The resource collection device obtains the current version number of the target resource.
- a second acquisition module configured to: before the receiving module receives the resource update message sent by the resource collection device, in the process of establishing a subscription relationship with the resource collection device, from the The resource collection device obtains the current version number of the target resource.
- the second acquisition module is specifically configured to: send a subscription request to the resource collection device, where the subscription request is used to request subscription to the target resource, and to receive the subscription request sent by the resource collection device In response, the response to the subscription request includes the current version number of the target resource.
- the subscription request includes first indication information, and the first indication information is used to indicate whether to set a version number for the target resource.
- the first obtaining module 13 is specifically configured to: determine the version number of the missing version of the target resource according to the first version number, the second version number, and the generation rule, and according to the The version number of the missing version of the target resource, requesting the missing version of the target resource from the resource collection device.
- the first obtaining module 13 requesting the missing version of the target resource from the resource collection device according to the version number of the missing version of the target resource includes:
- a response to the first request is received from the resource collection device, where the response to the first request includes the missing version of the target resource.
- the first obtaining module 13 before the first obtaining module 13 sends the first request to the resource collection device, it is further configured to:
- a second request is sent to the resource collection device, the second request is used to confirm whether a lost version of the target resource is stored on the resource collection device, and the second request includes the lost version of the target resource Version number;
- the first request is sent to the resource collection device.
- the subscription device 100 further includes:
- the sending module is configured to send a response to the resource update message to the resource collection device, and the response to the resource update message is used to notify the subscribing device that the resource update message is received.
- the target resource has multiple subscription relationships, and the multiple subscription relationships correspond to a version number of the target resource.
- the target resource has multiple subscription relationships, each subscription relationship corresponds to a version number of the target resource, and the multiple subscription relationships correspond to different version numbers of the target resource.
- the first request further includes identification information of the subscription relationship.
- both the first request and the second request include identification information of the subscription relationship.
- the subscription device provided in any implementation manner of this embodiment is used to execute the technical solution executed by the subscription device in any of the foregoing method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here.
- FIG. 5 is a schematic structural diagram of a resource collection device provided in Embodiment 4 of this application. As shown in FIG. 5, the method resource collection device 200 provided in this embodiment includes:
- the generating module 21 is used to generate a new version number for the target resource according to the generation rule of the version number and the current version number of the target resource stored locally when it is monitored that the target resource is updated, wherein, according to The version numbers generated by the generation rules have an association relationship;
- the update module 22 is configured to update the current version number of the target resource to the new version number
- the sending module 23 is configured to send a resource update message to the subscribing device, the resource update message including the first version number of the target resource and the update content of the target resource, and the first version number is the resource subscription The current version number of the target resource stored on the device.
- the sending module 23 is further configured to send the current version number of the target resource to the subscribing device in the process of establishing a subscription relationship with the subscribing device.
- the resource collection device 200 further includes: a receiving module 24, configured to receive a subscription request sent by the subscription device, where the subscription request is used to request subscription to the target resource; the sending module 23 is specifically configured to: The resource collection device sends a response to the subscription request, and the response to the subscription request includes the current version number of the target resource.
- the subscription request includes first indication information, and the first indication information is used to indicate whether to set a version number for the target resource.
- the resource collection device 200 further includes a retransmission module 25, configured to: after the sending module sends the resource update message, if the resource collection device does not receive the subscription device within a preset time In response to the resource update message, the resource update message is retransmitted to the subscribing device. When the preset maximum number of retransmissions is reached or when it is confirmed that the subscribing device has received the retransmitted resource update message, stop retransmitting the resource update message to the subscribing device.
- the resource collection device 200 further includes a search module.
- the receiving module 24 is further configured to receive a first request sent by the subscribing device, and the first request is used to request the missing version of the target resource.
- the first request includes the version number of the missing version of the target resource.
- the search module is configured to search for the missing version from a version list according to the version number of the missing version, where the current version of the target resource and one or more versions earlier than the current version are stored in the version list Versions.
- the sending module is configured to send a response to the first request to the subscription device when the missing version is found by the search module, and the response to the first request includes the information of the target resource Version is missing.
- the receiving module 24 is further configured to: before receiving the first request sent by the subscribing device, receive a second request sent by the subscribing device, where the second request is used to confirm the resource set Whether the missing version of the target resource is stored on the device, and the second request includes the version number of the missing version of the target resource.
- the search module is further configured to determine whether the lost version of the target resource is stored according to the version number of the lost version of the target resource and the version list.
- the sending module 23 is further configured to send a response to the second request to the subscription device, and the response to the second request is used to notify whether a missing version of the target resource is stored on the resource collection device.
- multiple versions in the version list that are earlier than the current version are multiple versions connected by version numbers.
- the target resource has multiple subscription relationships, and the multiple subscription relationships correspond to a version number of the target resource.
- the target resource has multiple subscription relationships, each subscription relationship corresponds to a version number of the target resource, and the multiple subscription relationships correspond to different version numbers of the target resource.
- the target resource has multiple subscription relationships, each subscription relationship corresponds to a version number of the target resource, and the multiple subscription relationships correspond to different version numbers of the target resource; the first The request also includes identification information of the subscription relationship corresponding to the missing version of the target resource.
- the target resource has multiple subscription relationships, each subscription relationship corresponds to a version number of the target resource, and the multiple subscription relationships correspond to different version numbers of the target resource; the first Both the request and the second request include identification information of the subscription relationship corresponding to the missing version of the target resource.
- the resource collection device provided in any implementation manner of this embodiment is used to execute the technical solution executed by the resource collection device in any of the foregoing method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here.
- FIG. 6 is a schematic structural diagram of a subscription device provided in Embodiment 5 of this application. As shown in FIG. 6, the subscription device 300 includes:
- the memory 32 stores computer execution instructions
- the processor 31 executes the computer-executable instructions stored in the memory, so that the processor 31 executes the technical solution executed by the subscription device in any of the foregoing method embodiments.
- FIG. 6 is a simple design of the subscription device.
- the embodiment of the present application does not limit the number of processors and memories in the subscription device.
- FIG. 6 only takes the number of 1 as an example for illustration.
- FIG. 7 is a schematic structural diagram of a resource collection device provided in Embodiment 6 of this application. As shown in FIG. 7, the resource collection device 400 includes:
- Processor 41 memory 42, interface 43 for communicating with other devices;
- the memory 42 stores computer execution instructions
- the processor 41 executes the computer-executable instructions stored in the memory, so that the processor 41 executes the technical solution executed by the resource collection device in any of the foregoing method embodiments.
- FIG. 8 is a simple design of a resource collection device.
- the embodiment of the present application does not limit the number of processors and memories in the resource collection device.
- FIG. 8 only uses 1 as an example for illustration.
- the memory, the processor, and the interface may be connected by a bus.
- the memory may be integrated inside the processor.
- An embodiment of the present application also provides a computer-readable storage medium.
- the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, it is used to implement the subscription device in any of the foregoing method embodiments.
- the embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the resources in any of the foregoing method embodiments.
- the embodiment of the present application also provides a program, when the program is executed by the processor, it is used to execute the technical solution executed by the subscription device in any of the foregoing method embodiments.
- the embodiment of the present application also provides a program, when the program is executed by the processor, it is used to execute the technical solution executed by the resource collection device in any of the foregoing method embodiments.
- the foregoing processor may be a chip.
- the embodiment of the present application also provides a computer program product, including program instructions, which are used to implement the technical solution executed by the subscription device in any of the foregoing method embodiments.
- the embodiment of the present application also provides a computer program product, including program instructions, which are used to implement the technical solution executed by the resource collection device in any of the foregoing method embodiments.
- An embodiment of the present application also provides a chip, which includes a processing module and a communication interface, and the processing module can execute the technical solution executed by the subscription device in any of the foregoing method embodiments.
- the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute any of the foregoing The technical solution executed by the subscription device in the method embodiment.
- a storage module such as a memory
- the storage module is used to store instructions
- the processing module is used to execute the instructions stored in the storage module
- the execution of the instructions stored in the storage module causes the processing module to execute any of the foregoing The technical solution executed by the subscription device in the method embodiment.
- An embodiment of the present application also provides a chip, including: a processing module and a communication interface, and the processing module can execute the technical solution executed by the resource collection device in any of the foregoing method embodiments.
- the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute any of the foregoing The technical solution executed by the resource collection device in the method embodiment.
- a storage module such as a memory
- the storage module is used to store instructions
- the processing module is used to execute the instructions stored in the storage module
- the execution of the instructions stored in the storage module causes the processing module to execute any of the foregoing The technical solution executed by the resource collection device in the method embodiment.
- the disclosed device and method may be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the modules is only a logical function division, and there may be other divisions in actual implementation, for example, multiple modules can be combined or integrated. To another system, or some features can be ignored, or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces.
- the indirect coupling or communication connection of the modules may be in electrical, mechanical or other forms.
- the processor may be a central processing unit (English: Central Processing Unit, abbreviated as: CPU), or other general-purpose processors or digital signal processors (English: Digital Signal Processor, referred to as DSP), Application Specific Integrated Circuit (English: Application Specific Integrated Circuit, referred to as ASIC), etc.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in this application can be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
- All or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware.
- the aforementioned program can be stored in a readable memory.
- the program executes the steps of the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviated as: ROM), RAM, flash memory, hard disk, Solid state hard disk, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), optical disc (English: optical disc) and any combination thereof.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Human Resources & Organizations (AREA)
- Entrepreneurship & Innovation (AREA)
- Strategic Management (AREA)
- Computer Security & Cryptography (AREA)
- Tourism & Hospitality (AREA)
- General Business, Economics & Management (AREA)
- Multimedia (AREA)
- Quality & Reliability (AREA)
- Operations Research (AREA)
- Marketing (AREA)
- Economics (AREA)
- Data Mining & Analysis (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本申请实施例提供一种资源的订阅方法、设备及存储介质,订阅设备和资源集合设备分别为订阅资源维护一个当前版本号,订阅资源的版本号是根据版本号的生成规则生成的,根据该生成规则生成的版本号之间具有关联关系,在资源更新过程中,订阅设备根据资源集合设备发送的订阅资源的当前版本号、本地保存的订阅资源的版本号以及生成规则,可以确定是否有版本丢失。并且在资源集合设备中保存有目标资源的当前版本之前的一个或者多个版本,当有版本丢失时,订阅设备可以从资源集合设备请求丢失版本,从而保证用户不会丢失订阅资源。
Description
本申请实施例涉及通信技术,尤其涉及一种资源的订阅方法、设备及存储介质。
随着互联网技术的发展和普及,通过互联网获取信息已经成为人们获取信息重要方式,例如,人们可以通过手机上安装的新闻应用(application,简称APP)向新闻提供商订阅喜欢的新闻主题,如时政大事、体育、娱乐等,当上述主题的新闻发生更新时,新闻提供商会向订阅了对应新闻的用户使用的APP推送对应的新闻消息,以供用户可以及时的阅读该新闻。随着上述订阅/推送技术的发展,该技术不仅用于设备与云平台(Device To Cloud,简称D2C)的信息传输,还可以应用在应用层下的业务处理层,设备与设备(Device To Device,简称D2D)领域以及物联网领域。例如手机订阅了家里温度计的温度,当温度计的温度>=26度时,开启空调。
现有的订阅/推送方案中,订阅设备(作为客户端)向订阅目标设备(作为服务器)发送订阅请求,订阅请求中可以包括订阅内容的标识、订阅设备的标识、订阅标识和请求标识等,订阅目标设备接收到订阅请求,认证该订阅请求并开始监测订阅内容是否发生变化,订阅目标设备还会向订阅设备返回订阅请求响应。当订阅目标设备监测到订阅内容发生变化时,向订阅设备发送通知消息,该通知消息中包括更新后的订阅内容。
但是,现有的订阅流程中,有可能由于通知消息丢失,导致订阅设备没有接收到目标订阅设备发送的更新后的订阅内容,造成用户丢失关键订阅内容。
发明内容
本申请实施例提供一种资源的订阅方法、设备及存储介质,能够保证用户订阅的资源不被丢失。
第一方面,本申请实施例可提供一种资源的订阅方法,应用于订阅设备,所述方法包括:
接收资源集合设备发送的资源更新消息,所述资源更新消息中包括订阅的目标资源的更新内容以及所述目标资源的第一版本号,所述第一版本号为所述资源集合设备上存储的所述目标资源的当前版本号;
根据所述第一版本号、本地存储的所述目标资源的第二版本号以及版本号的生成规则,确定所述目标资源的版本是否有丢失,其中,根据所述生成规则生成的版本号之间具有关联关系,所述订阅设备与所述资源集合设备使用的版本号的生成规则相同,所述第二版本号为所述订阅设备上存储的所述目标资源的当前版本号;
在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本,以及根据所述资源更新消息更新所述第二版本号;
在所述目标资源的版本没有丢失的情况下,根据所述资源更新消息更新所述第二版本号。
第二方面,本申请实施例可提供一种资源的订阅方法,应用于资源集合设备,所述方法包括:
当监测到目标资源有更新的情况下,根据版本号的生成规则和本地存储的所述目标资源的当前版本号,为所述目标资源生成新的版本号,将所述目标资源的当前版本号更新为所述新的版本号,其中,根据所述生成规则生成的版本号之间具有关联关系;
向订阅设备发送资源更新消息,所述资源更新消息中包括所述目标资源的第一版本号和所述目标资源的更新内容,所述第一版本号为所述资源订阅设备上存储的所述目标资源的当前版本号。
第三方面,本申请实施例可提供一种资源集合设备,包括:
接收模块,用于接收资源集合设备发送的资源更新消息,所述资源更新消息中包括订阅的目标资源的更新内容以及所述目标资源的第一版本号,所述第一版本号为所述资源集合设备上存储的所述目标资源的当前版本号;
确定模块,用于根据所述第一版本号、本地存储的所述目标资源的第二版本号以及版本号的生成规则,确定所述目标资源的版本是否有丢失,其中,根据所述生成规则生成的版本号之间具有关联关系,所述订阅设备与所述资源集合设备使用的版本号的生成规则相同,所述第二版本号为所述订阅设备上存储的所述目标资源的当前版本号;
第一获取模块,用于在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本;
更新模块,用于根据所述资源更新消息更新所述第二版本号。
第四方面,本申请实施例可提供一种资源集合设备,包括:
生成模块,用于当监测到目标资源有更新的情况下,根据版本号的生成规则和本地存储的所述目标资源的当前版本号,为所述目标资源生成新的版本号,其中,根据所述生成规则生成的版本号之间具有关联关系;
更新模块,用于将所述目标资源的当前版本号更新为所述新的版本号;
发送模块,用于向订阅设备发送资源更新消息,所述资源更新消息中包括所述目标资源的第一版本号和所述目标资源的更新内容,所述第一版本号为所述资源订阅设备上存储的所述目标资源的当前版本号。
第五方面,本申请实施例可提供一种订阅设备,包括:
处理器、存储器、与其他设备进行通信的接口;
所述存储器存储计算机执行指令;
所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如第一方面所述的资源的订阅方法。
第六方面,本申请实施例可提供一种资源集合设备,包括:
处理器、存储器、与其他设备进行通信的接口;
所述存储器存储计算机执行指令;
所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如第二方面所述的资源的订阅方法。
第七方面,本申请实施例可提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现如第一方面所述的资源的订阅方法。
第八方面,本申请实施例可提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现如第二方面所述的资源的订阅方法。
第九方面,本申请实施例提供一种程序,当该程序被处理器执行时,用于执行如上第一方面所述的资源的订阅方法。
第十方面,本申请实施例提供一种程序,当该程序被处理器执行时,用于执行如上第二方面所述的资源的订阅方法。
第十一方面,本申请实施例提供一种计算机程序产品,包括程序指令,程序指令用于实现上述第一方面所述的资源的订阅方法。
第十二方面,本申请实施例提供一种计算机程序产品,包括程序指令,程序指令用于实现上述第二方面所述的资源的订阅方法。
第十三方面,本申请实施例提供了一种芯片,包括:处理模块与通信接口,该处理模块能执行上述第一方面所述的资源的订阅方法。
进一步地,该芯片还包括存储模块(如,存储器),存储模块用于存储指令,处理模块用于执行存储模块存储的指令,并且对存储模块中存储的指令的执行使得处理模块执行第一方面所述的资源的订阅方法。
第十四方面,本申请实施例提供了一种芯片,包括:处理模块与通信接口,该处理模块能执行上述第二方面所述的资源的订阅方法。
进一步地,该芯片还包括存储模块(如,存储器),存储模块用于存储指令,处理模块用于执行存储模块存储的指令,并且对存储模块中存储的指令的执行使得处理模块执行第二方面所述的资源的订阅方法。
本申请实施例提供一种资源的订阅方法、设备和存储介质,订阅设备和资源集合设备分别为订阅资源维护一个当前版本号,订阅资源的版本号是根据版本号的生成规则生成的,根据该生成规则生成的版本号之间具有关联关系,在资源更新过程中,订阅设备根据资源集合设备发送的订阅资源的当前版本号、本地保存的订阅资源的版本号以及生成规则,可以确定是否有版本丢失。并且在资源集合设备中保存有目标资源的当前版本之前的一个或者多个版本,当有版本丢失时,订阅设备可以从资源集合设备请求丢失版本,从而保证用户不会丢失订阅资源。
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。
图1为本申请实施例适用的一种网络架构的示意图;
图2为本申请实施例一提供的资源的订阅方法的信令流程图;
图3为本申请实施例二提供的资源的订阅方法的信令流程图;
图4为本申请实施例三提供的订阅设备的结构示意图;
图5为本申请实施例四提供的资源集合设备的结构示意图;
图6为本申请实施例五提供的一种订阅设备的结构示意图;
图7为本申请实施例六提供的一种资源集合设备的结构示意图。
通过上述附图,已示出本发明明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本发明构思的范围,而是通过参考特定实施例为本领域技术人员说明本发明的概念。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例的说明书、权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例例如能够以除了在这里图示或描述 的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
图1为本申请实施例适用的一种网络架构的示意图,如图1所示,该网络架构中至少包括:订阅设备11和资源集合设备12,订阅设备11和资源集合设备12之间可以通过有线或者无线方式进行连接通信。可以理解的是,在实际网络部署中,订阅设备11和资源集合设备12均可以有一个或多个,该图1仅以一个作为示例。另外,图1所示架构中以订阅设备101为手机为例,可以理解,订阅设备101不限于手机,还可以为电脑、智能电视、游戏机等电子设备。
订阅设备11和资源集合设备12可以通过客户端/服务器(client/server,简称CS)模式通信,其中,订阅设备11作为客户端,资源集合设备12作为服务器。资源集合设备12用于为订阅设备11提供资源以及对资源进行管理,订阅设备11可以为从资源集合设备12处目标资源,资源集合设备根据12根据订阅设备订阅的内容向订阅设备11推送资源。
本实施例的方法可以应用在互联网场景时,在互联网场景下,订阅设备11可以为智能手机、电脑、智能电视等用于对智能家电进行控制的控制设备,订阅设备11可以通过安装的应用(app)对智能家电进行控制,该智能家电可以为智能台灯、智能音箱、智能空调。相应的,资源管理设备12对智能家电提供的资源进行管理,该资源可以为智能家电的功能,例如资源管理设备12中的资源包括:智能台灯的开关资源、智能台灯的亮度资源以及智能台灯的色彩资源,或者,智能空调的开关资源、智能空调的模式资源、智能空调的温度资源以及智能空调的风速资源等。
以订阅设备为11智能手机,智能手机上安装有对智能空调进行控制的app,用户可以通过该app订阅智能空调的开关资源和温度资源,资源集合设备12根据用户订阅的资源向智能手机发送资源的信息。
资源集合设备12管理有多个资源,资源通过唯一的资源标识进行区分。本申请实施例中,资源集合设备12可以管理一种或者多种智能家电的资源,例如网络中有多个资源集合设备,资源集合设备A只对智能空调的各种资源进行管理,资源集合设备B只对智能冰箱的各种资源进行管理,资源集合设备C可以对智能台灯的的各种资源进行管理。或者,同一个厂家的多种智能家电的资源由一个资源集合设备进行管理,例如,资源集合设备A对厂家A的智能家电的资源进行管理,资源集合B对厂家B的智能家电的资源进行管理。
传统方法中,订阅设备向资源集合设备订阅某个资源后,当该资源有更新时,资源集合设备向订阅设备发送资源更新消息,以更新该资源,但是资源集合设备发送的资源更新消息可能丢失,从而导致用户可能遗漏掉重要的信息。
为了解决现有技术的问题,本申请实施例中,为每个资源定义了版本号,当资源被更新后,按照资源的版本号的生成规则,为资源重新生成新的版本号,按照该生成规则生成的版本号之间具有关联关系,同一资源的不同版本号对应的版本内容不一样。每次更新资源时,资源集合设备都将资源的当前版本号携带在资源更新消息中发送给订阅设备,订阅设备根据版本号的生成规则、本地存储的该资源的当前版本号以及资源更新消息中包括的该资源的当前版本号,可以确定该资源的版本是否有丢失,由于按照该生成规则生成的版本号之间具有关联关系,因此,订阅设备能够根据接收到的当前版本号以及本地存储的版本号确定是否有版本丢失。进而根据丢失的版本的版本号向资源集合设备请求丢失的版本,从而保证用户不会丢失订阅资源。
需要明确,本申请实施例中涉及的目标资源的版本和目标资源的版本号不同,目标资源的版本号用于唯一标识一个目标资源的版本,目标资源的版本是指目标资源的信息或者内容,或者,某个版本的目标资源信息,目标资源的版本号是指目标资源的某个版本的版本号。
基于图1所示的网络架构,本申请实施例一提供一种资源的订阅方法,图2为本申请实施例一提供的资源的订阅方法的信令流程图,如图2所示,本实施例提供的方法包括以下步骤:
S101、订阅设备向资源集合设备发送订阅请求,该订阅请求用于请求订阅目标资源。
该订阅请求的消息类型可以为Retrieve,该订阅请求中包括以下信息:订阅设备的标识、目标资源的标识、请求标识、操作类型和资源集合设备的标识。
通常情况下,用户使用电子设备上安装的客户端(可以为app)进行资源的订阅,因此,订阅设备是指安装有订阅功能的客户端所在的设备,订阅设备的标识是指安装该客户端的电子设备的标识。
请求标识用于完成请求和响应(或者称为应答)的绑定,订阅设备发送订阅请求后,资源集合设备向该订阅设备返回的相关响应消息中均包括该请求标识,从而使得订阅设备能够确认消息之间的关系。
操作类型表示订阅请求对资源的操作,一般为CURDN,CURDN是Create(创建)、Update(更新)、Retrieve(取回)、Delete(删除)、Notify(修改)的缩写,CURDN也称为rest操作类型。
可选的,该订阅请求中还包括订阅标识,订阅标识用于唯一标识一个订阅关系,一个订阅关系由订阅设备、订阅的资源以及资源集合设备三者共同构成。后续订阅设备与资源集合设备交互的消息中可以携带该订阅标识,订阅设备与资源集合设备根据该订阅标识能够确定订阅关系。当订阅设备与资源集合设备交互的消息中不携带该订阅标识时,订阅设备和资源集合设备根据消息中包括的订阅设备的标识、订阅的资源的标识以及资源集合设备的标识三者共同确定订阅关系。
可选的,订阅请求中还可以包括第一指示信息,该第一指示信息用于指示是否为目标资源设置版本号,如果第一指示信息指示为目标资源设置版本号,则按照本申请实施例的方法进行资源订阅,如果第一指示信息指示不为目标资源设备版本号,则订阅设备不为目标资源生成版本号,按照传统方式进行资源订阅。第一指示信息例如用tagflag表示,当tagflag=true时表示为目标资源设备版本号,否则为无tag方式。当tagflag=false时表示不为目标资源设置版本号。
一种可能的实现方式中,tagflag的默认值是false或者true,用户在订阅资源之前可以选择是否为目标资源设置版本号。如果用户不选择,则将tagflag的默认值携带在订阅请求中。
资源集合设备接收到订阅请求后,一种方式中,如果第一指示信息指示为目标资源设置版本号,则资源集合设备为目标资源设置版本号,如果第一指示信息指示不为目标资源设置版本号,则资源集合设备不为目标资源设置版本号。另一种方式中,资源集合设备根据第一指示信息和自身的选择策略,确定是否为目标资源设置版本号。该选择策略例如可以为对部分订阅设备支持为目标资源设置版本号的方式,而对另一部分订阅设备不支持为目标资源设置版本号的方式,订阅设备的划分可以根据订阅设备的类型或者订阅设备的优先级或者其他参数划分,本实施例不对此进行限制。
可选的,订阅请求中不携带第一指示信息,而是携带订阅设备的能力信息,订阅设备的能力信息中表明订阅设备是否支持为目标资源设置版本号的方式,资源订阅设备可以根据订阅设备的能力信息决定是否为目标资源设置版本号。
可选的,在资源集合设备中也可以设置一个属性信息,该属性信息用于表明该资源集合设备是否支持为目标资源设置版本号的方式,订阅设备可以主动向资源集合设备查询资源集合设备是否支持为目标资源设置版本号的方式,也可以由资源集合设备主动通知订阅设备自己是否支持为目标资源设置版本号的方式。
可选的,订阅请求中也可以不携带第一指示信息和订阅设备的能力信息,资源集合设备根据上述的选择策略,决定是否为目标资源设备版本号。
本申请实施例中,多个订阅设备可以订阅相同的资源,即针对同一个资源存在多个订阅关系。例如,在一个家庭中共有三个成员,三个成员均可以订阅相同的资源,例如空调的温度资源,三个成员均使用各自的手机订阅空调的温度资源,即订阅设备不同,因此,共组成了三个订阅关系,三个订阅关系的订阅设备不同,但是订阅的资源和资源集合设备相同。
当目标资源具有多个订阅关系时,一种可能的实现方式中,该多个订阅关系对应该目标资源的一个版本号,即该目标资源在多个对应关系中具有相同的版本号。另一种可能的实现方式中,该多个订阅关系中的每个订阅关系对应目标资源的一个版本号,该多个订阅关系对应目标资源的多个版本号不同。
可以理解,本申请中的订阅请求是指能够实现请求订阅目标资源的任何消息,订阅请求的名称可能会随着网络的演进或者场景的变化有所不同,本申请只是举例说明,并不构成限定,订阅请求还可以替换为订阅消息、订阅请求消息,资源订阅请求等。
S102、资源集合设备记录订阅关系,开始监测目标资源,检查目标资源的当前版本号。
资源集合设备接收订阅请求后,根据订阅请求中包括的订阅设备的标识、目标资源的标识以及订阅设备的标识记录订阅关系。如果订阅请求中包括订阅标识,还记录该订阅标识与订阅关系的对应关系。
目标资源的当前版本号可以保存在本申请实施例新定义的一种类型的资源信息,该类型的资源信息可以包括:当前版本号(current tag)、版本列表(taglist)、目标资源的标识(targetresourceID)、订阅设备的标识(orginaldeviceID)、以及订阅类型(subscribetype)。
当前版本号为目标资源的最新版本号,资源集合设备持续监测目标资源,当目标资源发生变化时,根据预设的版本号的生成规则,为目标资源生成新的版本号,并将当前版本号更新为该新的版本号,每次目标资源变化后,资源集合设备都会为更新该目标资源的当前版本号。
版本列表中包括目标资源的当前版本以及早于当前版本之前的一个或者多个版本的内容,当目标资源的某个版本在发送过程中丢失时,订阅设备可以从该版本列表中请求到丢失的版本。
一种方式中,版本列表中包括目标资源的所有版本。
另一种方式中,为了节省资源集合设备的存储资源,版本列表中只包括目标资源的部分版本,除版本列表中版本外的其他版本均被资源集合设备删除了。
一种示例性的方式中,版本列表中包括的版本为目标资源的当前版本以及距离当前版本的更新时间最近的N个版本,N的取值大于或等于1,例如N的取值为3或者5。
以N的取值为3为例,假设目标资源的当前版本为第10个版本,那么距离当前版本的更新时间最近的3个版本为:第7-9个版本,因此版本列表中保存有目标资源第7-9个版本。该版本列表随着目标资源的当前版本号的变化而不断更新,例如,当前时刻目标资源的当前版本为第10个版本,在一段时间之后,目标资源的当前版本被更新为了第11个版本,那么资源集合设备相应的将第7个版本从版本列表移出去,将第10个版本增加到版本列表中。
另一种示例性的方式中,版本列表中的版本为当前版本以及版本更新时间距离当前时间在预设时间内的版本,例如,版本列表中保存有距离当前时间1个小时之内被更新的版本,更早时间的版本都被删除了。
再一种示例性的方式中,每次目标资源的版本被更新后,将更新前的版本加入到版本列表中,并为该版本开启一个定时器,在定时器的定时结束后,将该版本删除。版本列表中的每个版本均具有一个定时器,在定时器的定时结束后,将相应版本删除。
订阅类型可以包括创建、增加、删除和修改等类型。
可选的,该资源信息中还可以包括订阅标识(subscribeID)或者其他信息。
S103、资源集合设备向订阅设备发送订阅请求的响应,订阅请求的响应中包括目标资源的当前版本号。
订阅请求的响应用于通知订阅设备,资源集合设备接收到了订阅请求,订阅设备接收到订阅请求的响应后,从订阅请求的响应中获取到目标资源的当前版本号,并保存目标资源的当前版本号。订阅请求的响应中可以包括请求标识,订阅请求的响应中包括的请求标识与订阅请求中包括的请求标识相同,订阅设备根据该请求标识确定订阅请求的响应与订阅请求的关系。
可选的,订阅设备也可以维护一个和资源集合设备相同的资源信息,用于维护目标资源的当前版本号。每次目标资源被更新后,资源集合设备会向订阅设备同步更新后的目标资源,从而保证订阅设备和资源集合设备维护的目标资源的当前版本一致。
可选的,订阅设备维护的资源信息和资源集合设备维护的资源信息也可以不同,例如,相比于资源集合设备维护的资源信息,订阅设备维护的资源信息少了版本列表,或者,订阅设备维护的资源信息中不包括订阅标识。
本实施例中,订阅设备在与资源集合设备建立订阅关系的过程中,从资源集合设备获取目标资源的当前版本号,在建立订阅关系中获取的目标资源的当前版本号为目标资源的初始版本号。
步骤S101-S103描述的是订阅关系的一种建立方式:订阅设备向资源集合设备发送订阅请求,资源集合设备向订阅设备返回订阅请求的响应,订阅设备根据订阅请求的响应建立订阅关系。在其他实施例中,订阅关系的建立还可以包括更多的消息交互,本实施例并不对此进行限制。
S104、当监测到目标资源有更新的情况下,资源集合设备根据版本号的生成规则为目标资源生成新的版本号,并将本地存储的目标资源的当前版本号更新为新的版本号,其中,根据该生成规则生成的版本号之间具有关联关系。
资源集合设备本地存储的目标资源的当前版本号是指资源集合设备中存储的当前版本号,本申请实施例中,在资源集合设备和订阅设备中分别存储有目标资源的当前版本号。
该生成规则为订阅设备和资源集合设备共同使用的规则,订阅设备和资源集合设备可以预先协商好使用的生成规则,或者,该生成规则预置在订阅设备的客户端和资源集合设备中,还可以由其他设备通知给订阅设备和资源集合设备。
根据该生成规则生成的版本号之间具有关联关系,例如,目标资源的版本号由小到大递增,或者,目标资源的版本号由大到小递减,其中每次增加或者递减的步长为一固定值。版本号还可以循环使用,例如,版本号为0-99,目标资源的当前版本号的初始值为0,后续每当目标资源更新,将当前版本号加1,当目标资源的版本号从0增加到99之后,重新从0开始对版本号进行赋值。
假设T0时刻目标资源的当前版本号为21,在T1(T1时刻晚于T0时刻)时刻监测到目标资源有更新,资源集合设备为目标资源生成新的版本号22,将目标资源的当前版本号更新为22。
S105、资源集合设备向订阅设备发送资源更新消息,资源更新消息中包括目标资源的第一版本号和目标资源的更新内容,第一版本号为资源订阅设备上存储的目标资源的当前版本号。
该第一版本号为目标资源的最新版本号,资源集合设备通过资源更新消息将更新内容发送给订阅设备。本申请实施例不对资源更新消息进行限定,只要能够实现类似功能的消息都可以称为资源更新消息,另外,资源更新消息的名称不做限定,还可以称为通知消息、更新消息或者其他消息。
S106、订阅设备根据资源更新消息中包括的第一版本号、本地存储的目标资源的第二版本号以及版本号的生成规则,确定目标资源的版本是否有丢失。
其中,根据该生成规则生成的版本号之间具有关联关系,订阅设备与资源集合设备使用的版本号的生成规则相同,第二版本号为订阅设备上存储的目标资源的当前版本号。本申请实施例中,订阅设备和资源集合设备分别为目标设备维护一个当前版本号,假设在不发生资源更新消息丢失的情况下,在订阅设备和资源集合设备完成资源更新的情况下,订阅设备和资源集合设备上存储的目标资源的当前版本相同。
由于订阅设备和资源集合设备使用相同的生成规则,且生成的版本号之间具有关联关系,订阅设备可以根据本地存储的订阅资源的当前版本和生成规则确定下一次资源更新时资源更新消息中包括的版本号。
订阅设备可以根据本地存储的目标资源的第二版本号以及版本号的生成规则,确定本次资源更新后目标资源的版本号,将确定得到的本次资源更新后目标资源的版本号与资源更新消息中包括的第一版本号比较,如果二者相同,则确定目标资源的版本没有丢失,如果二者不相同,则确定目标资源的版本有丢失。
例如,订阅设备上存储的目标资源的第二版本号为7,生成规则为在前一版本号的基础上加1,订阅设备根据第二版本号和生成规则可以确定本次资源更新后目标资源的版本号为8,但是资源更新消息中的第一版本号为9,如果没有版本丢失,订阅设备确定的本地更新后目标资源的版本号应该与第一版本号相同,二者不相同,说明有版本丢失,根据生成规则,可知版本号为8的版本丢失了。
在目标资源的版本有丢失的情况下,执行步骤S107,在目标资源的版本没有丢失的情况下,执行步骤S108。
S107、订阅设备从资源集合设备获取目标资源的丢失版本。
步骤S107为可选步骤,如果目标资源的版本没有丢失,则不执行S107,直接执行S108,进行第二版本号的修改。
订阅设备根据第一版本号、第二版本号以及该生成规则,不仅能够确定丢失了版本,还能确定丢失版本的版本号,进而根据目标资源的丢失版本的版本号,向资源集合设备请求目标资源的丢失版本。
一种方式中,订阅设备向资源集合设备发送第一请求,该第一请求用于请求目标资源的丢失版本,该第一请求中包括目标资源的丢失版本的版本号,从资源集合设备接收第一请求的响应,第一请求的响应中包括目标资源的丢失版本。
资源集合设备接收到第一请求后,根据丢失版本的版本号从本地存储的该目标资源的版本中查找该丢失版本是否存在,如果丢失版本还存储在资源集合设备中,则资源集合设备将丢失版本携带在第一请求的响应中发送给订阅设备,如果丢失版本已经从资源设备设备中删除了,那么资源集合设备可以向订阅设备返回请求失败响应,请求失败响应可以携带在第一请求的响应中。
资源集合设备中可以维护一个版本列表,该版本列表中包括目标资源的当前版本之前的一个或者多个版本的内容以及版本号,资源集合设备接收到第一请求后,从版本列表中查询是否存在丢失版本的版本号。
目标资源的丢失版本可能为一个或者多个,如果目标资源的丢失版本为多个,订阅设备可以通过多个第一请求向资源集合设备请求丢失版本,每个第一请求中只包括一个丢失版本的版本号。当然,订阅设备也可以在第一请求中携带多个丢失版本的版本号,资源集合设备可以通过一个响应消息将多个丢失版本发送给订阅设备,资源集合设备也可以通过多条响应消息将多个丢失版本发送给订阅设备,其中,每个响应消息中携带一个丢失版本。
资源集合设备可能只存储有丢失的多个版本中的部分版本,该情况下,资源集合设备只将存储的丢失版本发送给订阅设备。
另一种方式中,订阅设备在向资源集合设备发送第一请求之前,向资源集合设备发送第二请求,该第二请求用于确认资源集合设备上是否存储有目标资源的丢失版本,第二请求中包括目标资源的丢失版本的版本号,从资源集合设备接收第二请求的响应,第二请求的响应用于通知资源集合设备上是否存储有目标资源的丢失版本,当根据第二请求的响应确定资源集合设备上存储有目标资源的丢失版本的情况下,向资源集合设备发送第一请求。
资源集合设备接收到第二请求后,从版本列表中查询是否存在丢失版本的版本号,如果版本列表中存在丢失版本的版本号,则确定资源集合设备存储有目标资源的丢失版本,如果版本列表中不存在丢失版本的版本号,则确定资源集合中没有存储目标资源的丢失版本,版本列表中也可能只存在部分丢失版本的版本号。
第二请求的响应中可以通过一个或者多个比特位指示资源集合设备上是否存储有目标资源的丢失版本,以一个比特位为例,当该比特位的值为1时表示资源集合设备上存储有目标资源的丢失版本,当该比特位的值为0时表示资源集合设备上没有存储目标资源的丢失版本。
当目标资源具有多个订阅关系,且该多个订阅关系中的每个订阅关系对应目标资源的一个版本号,该多个订阅关系对应目标资源的多个版本号不同时,第一请求中还包括订阅关系的标识信息,订阅设备通过丢失版本的版本号和订阅关系的标识信息从资源集合设备获取到丢失版本。
S108、订阅设备根据资源更新消息更新第二版本号。
订阅设备接收到资源更新消息之后,将第二版本号更新为资源更新消息中包括的第一版本号,更新完成后订阅设备和资源集合设备上存储的目标资源的当前版本号相同。
本实施例中,订阅设备和资源集合设备分别为订阅资源维护一个当前版本号,订阅资源的版本号是根据版本号的生成规则生成的,根据该生成规则生成的版本号之间具有关联关系,在资源更新过程中,订阅设备根据资源集合设备发送的订阅资源的当前版本号、本地保存的订阅资源的版本号以及生成规则,可以确定是否有版本丢失。并且在资源集合设备中保存有目标资源的当前版本之前的一个或者多个版本,当有版本丢失时,订阅设备可以从资源集合设备请求丢失版本,从而保证用户不会丢失订阅资源。
图3为本申请实施例二提供的资源的订阅方法的信令流程图,如图3所示,本实施例的方法在图2所示方法的基础上,订阅设备在接收到资源更新消息后,向资源集合设备发送响应消息,资源集合设备如果没有接收到资源更新消息的响应消息,则会重发该资源更新消息。如图3所示,本实施例提供的方法包括以下步骤:
S201、订阅设备向资源集合设备发送订阅请求,该订阅请求用于请求订阅目标资源。
S202、资源集合设备记录订阅关系,开始监测目标资源,检查目标资源的当前版本号。
S203、资源集合设备向订阅设备发送订阅请求的响应,订阅请求的响应中包括目标资源的当前版本号。
S204、当监测到目标资源有更新的情况下,资源集合设备根据版本号的生成规则为目标资源生成新的版本号,并将本地存储的目标资源的当前版本号更新为新的版本号,
其中,根据该生成规则生成的版本号之间具有关联关系,资源集合设备和订阅设备针对该目标资源使用的生成规则相同。
S205、资源集合设备向订阅设备发送资源更新消息,资源更新消息中包括目标资源的第一版本号和目标资源的更新内容,第一版本号为资源订阅设备上存储的目标资源的当前版本号。
步骤S201-S205的具体实现和相关描述可参照实施例一S101-105,这里不再赘述。
S206、订阅设备向资源集合设备发送资源更新消息的响应。
资源更新消息的响应用于确认订阅设备已经接收到了资源更新消息,该订阅更新消息的响应中可以包括目标资源的当前版本号和目标资源的标识。
可选的,资源更新消息的响应中还可以包括订阅类型和/或订阅关系的标识信息,订阅关系的标识信息可以为订阅标识,订阅关系的标识信息还可以由订阅设备的标识、订阅资源的标识以及资源集合设备的标识组成。
S207、在发送资源更新消息之后,如果在预设时间内没有接收到资源更新消息的响应,则资源集合设备向订阅设备重新发送该资源更新消息。
步骤S207为可选步骤,如果资源集合设备在预设时间内接收到了资源更新消息的响应,则不执行本步骤,即不会进行资源更新消息的重传。
资源集合设备在发送资源更新消息后,可以启动一个定时器,如果在定时器超时之前,没有接收到资源更新消息的响应,则重发该资源更新消息,如果在定时器超时前,接收到了资源更新消息的响应,则确定订阅设备接收到了资源更新消息。
资源集合设备在以下两种情况下可能接收不到资源更新消息的响应:资源更新消息丢失了,订阅设备没有接收到资源更新消息,自然不会发送资源更新消息的响应;订阅设备接收到了资源更新消息,且发送了资源更新消息的响应,但是资源更新消息的响应丢失了。上述两种情况下,资源集合设备都会向订阅设备重新发送该资源更新消息。
需要明确是,图中步骤S207并不表示一个步骤,而是表示一个重传过程,该重传过程中可以进行一次或者多次重传,资源集合设备可以设置一个最大重传次数K,K的取值例如为3或者4。在预设最大重发次数到达的情况下或者在确认订阅设备接收到重发的资源更新消息的情况下,停止向订阅设备重发资源更新消息。
资源集合设备每次重传资源更新消息后,如果订阅设备接收到了重传的资源更新消息,订阅设备会向资源集合设备返回资源更新消息的响应,资源集合设备接收到资源更新消息的响应后,确定资源更新消息重传成功,停止重传该资源更新消息。
资源集合设备可能通过一次或者多次重传才能将资源更新消息重传成功,如果资源集合设备通过一次重传就重传成功,则不进行后续的重传,如果一次重传之后,在规定时间没有接收到重传的资源更新消息的响应,则确定本次重传失败,进行下一次重传,只至重传成功或者重传次数达到最大值K之后,停止重传操作。
S208、订阅设备根据资源更新消息中包括的第一版本号、本地存储的目标资源的第二版本号以及版本号的生成规则,确定目标资源的版本是否有丢失。
本步骤中的资源更新消息可能是资源集合设备重传的资源更新消息,也可能是资源集合设备初传的资源更新消息。在目标资源的版本有丢失的情况下,执行步骤S209,在目标资源的版本没有丢失的情况下,执行步骤S210。
S209、订阅设备从资源集合设备获取目标资源的丢失版本。
S210、订阅设备根据资源更新消息更新第二版本号。
S208-S210的具体实现方式参照实施例一中步骤S106-S108的描述,这里不再赘述。
本实施例中,订阅设备在接收到资源更新消息后,会向资源集合设备返回资源更新消息的响应,资源集合设备根据资源更新消息的响应能够及时的确定确定资源更新消息是否丢失,在资源更新消息有丢失的情况下,通过重传资源更新消息,保证用户能够及时的获取到丢失版本。即使没有重传成功的情况下,订阅设备也能够在订阅资源下次被更新时, 根据订阅资源的版本号发现丢失版本,进而从资源集合设备获取到丢失版本,保证用户不会丢失订阅资源。
图4为本申请实施例三提供的订阅设备的结构示意图,如图4所示,本实施例提供的方法订阅设备100包括:
接收模块11,用于接收资源集合设备发送的资源更新消息,所述资源更新消息中包括订阅的目标资源的更新内容以及所述目标资源的第一版本号,所述第一版本号为所述资源集合设备上存储的所述目标资源的当前版本号;
确定模块12,用于根据所述第一版本号、本地存储的所述目标资源的第二版本号以及版本号的生成规则,确定所述目标资源的版本是否有丢失,其中,根据所述生成规则生成的版本号之间具有关联关系,所述订阅设备与所述资源集合设备使用的版本号的生成规则相同,所述第二版本号为所述订阅设备上存储的所述目标资源的当前版本号;
第一获取模块13,用于在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本;
更新模块14,用于根据所述资源更新消息更新所述第二版本号。
可选的,订阅设备100还包括:第二获取模块,用于在所述接收模块接收资源集合设备发送的资源更新消息之前,在与所述资源集合设备建立订阅关系的过程中,从所述资源集合设备获取所述目标资源的当前版本号。
可选的,所述第二获取模块具体用于:向所述资源集合设备发送订阅请求,所述订阅请求用于请求订阅所述目标资源,接收所述资源集合设备发送的所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
可选的,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
可选的,所述第一获取模块13具体用于:根据所述第一版本号、所述第二版本号以及所述生成规则,确定所述目标资源的丢失版本的版本号,根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本。
可选的,所述第一获取模块13根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本,包括:
向所述资源集合设备发送第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号;
从所述资源集合设备接收所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
可选的,所述第一获取模块13向所述资源集合设备发送第一请求之前,还用于:
向所述资源集合设备发送第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号;
从所述资源集合设备接收所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本;
当根据所述第二请求的响应确定所述资源集合设备上存储有所述目标资源的丢失版本的情况下,向所述资源集合设备发送所述第一请求。
可选的,订阅设备100还包括:
发送模块,用于向所述资源集合设备发送所述资源更新消息的响应,所述资源更新消息的响应用于通知所述订阅设备接收到了所述资源更新消息。
可选的,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
可选的,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
当所述目标资源具有多个订阅关系时,所述第一请求中还包括所述订阅关系的标识信息。
当所述目标资源具有多个订阅关系,所述第一请求和所述第二请求中均包括所述订阅关系的标识信息。
本实施例任一实现方式提供的订阅设备,用于执行前述任一方法实施例中订阅设备执行的技术方案,其实现原理和技术效果类似,在此不再赘述。
图5为本申请实施例四提供的资源集合设备的结构示意图,如图5所示,本实施例提供的方法资源集合设备200包括:
生成模块21,用于当监测到目标资源有更新的情况下,根据版本号的生成规则和本地存储的所述目标资源的当前版本号,为所述目标资源生成新的版本号,其中,根据所述生成规则生成的版本号之间具有关联关系;
更新模块22,用于将所述目标资源的当前版本号更新为所述新的版本号;
发送模块23,用于向订阅设备发送资源更新消息,所述资源更新消息中包括所述目标资源的第一版本号和所述目标资源的更新内容,所述第一版本号为所述资源订阅设备上存储的所述目标资源的当前版本号。
可选的,所述发送模块23还用于:在与所述订阅设备建立订阅关系的过程中,向所述订阅设备发送所述目标资源的当前版本号。
可选的,资源集合设备200还包括:接收模块24,用于接收所述订阅设备发送的订阅请求,所述订阅请求用于请求订阅所述目标资源;所述发送模块23具体用于:向所述资源集合设备发送所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
可选的,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
可选的,资源集合设备200还包括重发模块25,用于:在所述发送模块发送所述资源更新消息之后,如果在预设时间内所述资源集合设备没有接收到所述订阅设备发送的所述资源更新消息的响应,则向所述订阅设备重发所述资源更新消息。在预设最大重发次数到达的情况下或者在确认所述订阅设备接收到重发的所述资源更新消息的情况下,停止向所述订阅设备重发所述资源更新消息。
可选的,资源集合设备200还包括查找模块,相应的,接收模块24还用于接收所述订阅设备发送的第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号。查找模块,用于根据所述丢失版本的版本号,从版本列表中查找所述丢失版本,所述版本列表中保存有所述目标资源的当前版本以及早于所述当前版本之前的一个或者多个版本。所述发送模块,用于当所述查找模块查找到所述丢失版本的情况下,向所述订阅设备发送所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
可选的,所述接收模块24,还用于:在接收所述订阅设备发送的第一请求之前,接收所述订阅设备发送的第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号。所述查找模块,还用于根据所述目标资源的丢失版本的版本号和所述版本列表,确定是否存储有所述目标资源的丢失版本。所述发送模块23,还用于向所述订阅设备发送所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本。
可选的,所述版本列表中早于所述当前版本之前的多个版本为版本号相连的多个版本。
可选的,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
可选的,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
可选的,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求中还包括所述目标资源的丢失版本对应的订阅关系的标识信息。
可选的,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求和所述第二请求中均包括所述目标资源的丢失版本对应的订阅关系的标识信息。
本实施例任一实现方式提供的资源集合设备,用于执行前述任一方法实施例中资源集合设备执行的技术方案,其实现原理和技术效果类似,在此不再赘述。
图6为本申请实施例五提供的一种订阅设备的结构示意图,如图6所示,该订阅设备300包括:
处理器31、存储器32、与其他设备进行通信的接口33;
所述存储器32存储计算机执行指令;
所述处理器31执行所述存储器存储的计算机执行指令,使得所述处理器31执行前述任一方法实施例中订阅设备执行的技术方案。
图6为订阅设备的一种简单设计,本申请实施例不限制订阅设备中处理器和存储器的个数,图6仅以个数为1作为示例说明。
图7为本申请实施例六提供的一种资源集合设备的结构示意图,如图7所示,该资源集合设备400包括:
处理器41、存储器42、与其他设备进行通信的接口43;
所述存储器42存储计算机执行指令;
所述处理器41执行所述存储器存储的计算机执行指令,使得所述处理器41执行前述任一方法实施例中资源集合设备执行的技术方案。
图8为资源集合设备的一种简单设计,本申请实施例不限制资源集合设备中处理器和存储器的个数,图8仅以个数为1作为示例说明。
在上述实施例所示的订阅设备或资源集合设备的一种具体实现中,存储器、处理器以及接口之间可以通过总线连接,可选的,存储器可以集成在处理器内部。
本申请实施例还提供一种计算机可读存储介质所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现前述任一方法实施例中订阅设备执行的技术方案。
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现前述任一方法实施例中资源集合设备执行的技术方案。
本申请实施例还提供一种程序,当该程序被处理器执行时,用于执行前述任一方法实施例中订阅设备执行的技术方案。
本申请实施例还提供一种程序,当该程序被处理器执行时,用于执行前述任一方法实施例中资源集合设备执行的技术方案。
可选地,上述处理器可以为芯片。
本申请实施例还提供一种计算机程序产品,包括程序指令,程序指令用于实现前述任一方法实施例中订阅设备执行的技术方案。
本申请实施例还提供一种计算机程序产品,包括程序指令,程序指令用于实现前述任一方法实施例中资源集合设备执行的技术方案。
本申请实施例还提供一种芯片,包括:处理模块与通信接口,该处理模块能执行前述任一方法实施例中订阅设备执行的技术方案。
进一步地,该芯片还包括存储模块(如,存储器),存储模块用于存储指令,处理模块用于执行存储模块存储的指令,并且对存储模块中存储的指令的执行使得处理模块执行前述任一方法实施例中订阅设备执行的技术方案。
本申请实施例还提供一种芯片,包括:处理模块与通信接口,该处理模块能执行前述任一方法实施例中资源集合设备执行的技术方案。
进一步地,该芯片还包括存储模块(如,存储器),存储模块用于存储指令,处理模块用于执行存储模块存储的指令,并且对存储模块中存储的指令的执行使得处理模块执行前述任一方法实施例中资源集合设备执行的技术方案。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
在上述资源集合设备和订阅设备的具体实现中,应理解,处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一可读取存储器中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储器(存储介质)包括:只读存储器(英文:read-only memory,简称:ROM)、RAM、快闪存储器、硬盘、固态硬盘、磁带(英文:magnetic tape)、软盘(英文:floppy disk)、光盘(英文:optical disc)及其任意组合。
Claims (52)
- 一种资源的订阅方法,应用于订阅设备,其特征在于,包括:接收资源集合设备发送的资源更新消息,所述资源更新消息中包括订阅的目标资源的更新内容以及所述目标资源的第一版本号,所述第一版本号为所述资源集合设备上存储的所述目标资源的当前版本号;根据所述第一版本号、本地存储的所述目标资源的第二版本号以及版本号的生成规则,确定所述目标资源的版本是否有丢失,其中,根据所述生成规则生成的版本号之间具有关联关系,所述订阅设备与所述资源集合设备使用的版本号的生成规则相同,所述第二版本号为所述订阅设备上存储的所述目标资源的当前版本号;在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本,以及根据所述资源更新消息更新所述第二版本号;在所述目标资源的版本没有丢失的情况下,根据所述资源更新消息更新所述第二版本号。
- 根据权利要求1所述的方法,其特征在于,接收资源集合设备发送的资源更新消息之前,还包括:在与所述资源集合设备建立订阅关系的过程中,从所述资源集合设备获取所述目标资源的当前版本号。
- 根据权利要求2所述的方法,其特征在于,所述在与所述资源集合设备建立订阅关系的过程中,从所述资源集合设备获取所述目标资源的当前版本号,包括:向所述资源集合设备发送订阅请求,所述订阅请求用于请求订阅所述目标资源;接收所述资源集合设备发送的所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
- 根据权利要求2或3所述的方法,其特征在于,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
- 根据权利要求1-4中任一项所述的方法,其特征在于,在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本,包括:根据所述第一版本号、所述第二版本号以及所述生成规则,确定所述目标资源的丢失版本的版本号;根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本。
- 根据权利要求5所述的方法,其特征在于,所述根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本,包括:向所述资源集合设备发送第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号;从所述资源集合设备接收所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
- 根据权利要求6所述的方法,其特征在于,向所述资源集合设备发送第一请求之前,还包括:向所述资源集合设备发送第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号;从所述资源集合设备接收所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本;当根据所述第二请求的响应确定所述资源集合设备上存储有所述目标资源的丢失版本的情况下,向所述资源集合设备发送所述第一请求。
- 根据权利要求1-7任一项所述的方法,其特征在于,还包括:向所述资源集合设备发送所述资源更新消息的响应,所述资源更新消息的响应用于通知所述订阅设备接收到了所述资源更新消息。
- 根据权利要求1-8任一项所述的方法,其特征在于,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
- 根据权利要求1-5任一项所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
- 根据权利要求6所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求中还包括所述订阅关系的标识信息。
- 根据权利要求6所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求和所述第二请求中均包括所述订阅关系的标识信息。
- 一种资源的订阅方法,应用于资源集合设备,其特征在于,包括:当监测到目标资源有更新的情况下,根据版本号的生成规则和本地存储的所述目标资源的当前版本号,为所述目标资源生成新的版本号,将所述目标资源的当前版本号更新为所述新的版本号,其中,根据所述生成规则生成的版本号之间具有关联关系;向订阅设备发送资源更新消息,所述资源更新消息中包括所述目标资源的第一版本号和所述目标资源的更新内容,所述第一版本号为所述资源订阅设备上存储的所述目标资源的当前版本号。
- 根据权利要求13所述的方法,其特征在于,还包括:在与所述订阅设备建立订阅关系的过程中,向所述订阅设备发送所述目标资源的当前版本号。
- 根据权利要求14所述的方法,其特征在于,在与订阅设备建立订阅关系的过程中,向所述订阅设备发送所述目标资源的当前版本号,包括:接收所述订阅设备发送的订阅请求,所述订阅请求用于请求订阅所述目标资源;向所述资源集合设备发送所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
- 根据权利要求15所述的方法,其特征在于,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
- 根据权利要求13-16中任一项所述的方法,其特征在于,还包括:在发送所述资源更新消息之后,如果在预设时间内没有接收到所述订阅设备发送的所述资源更新消息的响应,则向所述订阅设备重发所述资源更新消息;在预设最大重发次数到达的情况下或者在确认所述订阅设备接收到重发的所述资源更新消息的情况下,停止向所述订阅设备重发所述资源更新消息。
- 根据权利要求13-17中任一项所述的方法,其特征在于,所述方法还包括:接收所述订阅设备发送的第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号;根据所述丢失版本的版本号,从版本列表中查找所述丢失版本,所述版本列表中保存有所述目标资源的当前版本以及早于所述当前版本之前的一个或者多个版本;当查找到所述丢失版本的情况下,向所述订阅设备发送所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
- 根据权利要求18所述的方法,其特征在于,接收所述订阅设备发送的第一请求之前还包括:接收所述订阅设备发送的第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号;根据所述目标资源的丢失版本的版本号和所述版本列表,确定是否存储有所述目标资源的丢失版本;向所述订阅设备发送所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本。
- 根据权利要求18或19所述的方法,其特征在于,所述版本列表中早于所述当前版本之前的多个版本为版本号相连的多个版本。
- 根据权利要求13-20任一项所述的方法,其特征在于,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
- 根据权利要求13-20任一项所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
- 根据权利要求18所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求中还包括所述目标资源的丢失版本对应的订阅关系的标识信息。
- 根据权利要求19所述的方法,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求和所述第二请求中均包括所述目标资源的丢失版本对应的订阅关系的标识信息。
- 一种订阅设备,其特征在于,包括:接收模块,用于接收资源集合设备发送的资源更新消息,所述资源更新消息中包括订阅的目标资源的更新内容以及所述目标资源的第一版本号,所述第一版本号为所述资源集合设备上存储的所述目标资源的当前版本号;确定模块,用于根据所述第一版本号、本地存储的所述目标资源的第二版本号以及版本号的生成规则,确定所述目标资源的版本是否有丢失,其中,根据所述生成规则生成的版本号之间具有关联关系,所述订阅设备与所述资源集合设备使用的版本号的生成规则相同,所述第二版本号为所述订阅设备上存储的所述目标资源的当前版本号;第一获取模块,用于在所述目标资源的版本有丢失的情况下,从所述资源集合设备获取所述目标资源的丢失版本;更新模块,用于根据所述资源更新消息更新所述第二版本号。
- 根据权利要25所述的设备,其特征在于,还包括:第二获取模块,用于在所述接收模块接收资源集合设备发送的资源更新消息之前,在与所述资源集合设备建立订阅关系的过程中,从所述资源集合设备获取所述目标资源的当前版本号。
- 根据权利要求26所述的设备,其特征在于,所述第二获取模块具体用于:向所述资源集合设备发送订阅请求,所述订阅请求用于请求订阅所述目标资源;接收所述资源集合设备发送的所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
- 根据权利要求26或27所述的设备,其特征在于,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
- 根据权利要求25-28中任一项所述的设备,其特征在于,所述第一获取模块具体用于:根据所述第一版本号、所述第二版本号以及所述生成规则,确定所述目标资源的丢失版本的版本号;根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本。
- 根据权利要求29所述的设备,其特征在于,所述第一获取模块根据所述目标资源的丢失版本的版本号,向所述资源集合设备请求所述目标资源的丢失版本,包括:向所述资源集合设备发送第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号;从所述资源集合设备接收所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
- 根据权利要求30所述的设备,其特征在于,所述第一获取模块向所述资源集合设备发送第一请求之前,还用于:向所述资源集合设备发送第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号;从所述资源集合设备接收所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本;当根据所述第二请求的响应确定所述资源集合设备上存储有所述目标资源的丢失版本的情况下,向所述资源集合设备发送所述第一请求。
- 根据权利要求25-31任一项所述的设备,其特征在于,还包括:发送模块,用于向所述资源集合设备发送所述资源更新消息的响应,所述资源更新消息的响应用于通知所述订阅设备接收到了所述资源更新消息。
- 根据权利要求25-32任一项所述的设备,其特征在于,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
- 根据权利要求25-32任一项所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
- 根据权利要求30所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求中还包括所述订阅关系的标识信息。
- 根据权利要求31所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求和所述第二请求中均包括所述订阅关系的标识信息。
- 一种资源集合设备,其特征在于,包括:生成模块,用于当监测到目标资源有更新的情况下,根据版本号的生成规则和本地存储的所述目标资源的当前版本号,为所述目标资源生成新的版本号,其中,根据所述生成规则生成的版本号之间具有关联关系;更新模块,用于将所述目标资源的当前版本号更新为所述新的版本号;发送模块,用于向订阅设备发送资源更新消息,所述资源更新消息中包括所述目标资源的第一版本号和所述目标资源的更新内容,所述第一版本号为所述资源订阅设备上存储的所述目标资源的当前版本号。
- 根据权利要求37所述的设备,其特征在于,所述发送模块还用于:在与所述订阅设备建立订阅关系的过程中,向所述订阅设备发送所述目标资源的当前版本号。
- 根据权利要求38所述的设备,其特征在于,还包括:接收模块,用于接收所述订阅设备发送的订阅请求,所述订阅请求用于请求订阅所述目标资源;所述发送模块具体用于:向所述资源集合设备发送所述订阅请求的响应,所述订阅请求的响应中包括所述目标资源的当前版本号。
- 根据权利要求39所述的设备,其特征在于,所述订阅请求中包括第一指示信息,所述第一指示信息用于指示是否为所述目标资源设置版本号。
- 根据权利要求37-40中任一项所述的设备,其特征在于,还包括重发模块,用于:在所述发送模块发送所述资源更新消息之后,如果在预设时间内所述资源集合设备没有接收到所述订阅设备发送的所述资源更新消息的响应,则向所述订阅设备重发所述资源更新消息;在预设最大重发次数到达的情况下或者在确认所述订阅设备接收到重发的所述资源更新消息的情况下,停止向所述订阅设备重发所述资源更新消息。
- 根据权利要求37-41中任一项所述的设备,其特征在于,还包括:接收模块,用于接收所述订阅设备发送的第一请求,所述第一请求用于请求所述目标资源的丢失版本,所述第一请求中包括所述目标资源的丢失版本的版本号;查找模块,用于根据所述丢失版本的版本号,从版本列表中查找所述丢失版本,所述版本列表中保存有所述目标资源的当前版本以及早于所述当前版本之前的一个或者多个版本;所述发送模块,用于当所述查找模块查找到所述丢失版本的情况下,向所述订阅设备发送所述第一请求的响应,所述第一请求的响应中包括所述目标资源的丢失版本。
- 根据权利要求42所述的设备,其特征在于,所述接收模块,还用于:在接收所述订阅设备发送的第一请求之前,接收所述订阅设备发送的第二请求,所述第二请求用于确认所述资源集合设备上是否存储有所述目标资源的丢失版本,所述第二请求中包括所述目标资源的丢失版本的版本号;所述查找模块,还用于根据所述目标资源的丢失版本的版本号和所述版本列表,确定是否存储有所述目标资源的丢失版本;所述发送模块,还用于向所述订阅设备发送所述第二请求的响应,所述第二请求的响应用于通知所述资源集合设备上是否存储有所述目标资源的丢失版本。
- 根据权利要求42或43所述的设备,其特征在于,所述版本列表中早于所述当前版本之前的多个版本为版本号相连的多个版本。
- 根据权利要求37-44任一项所述的设备,其特征在于,所述目标资源具有多个订阅关系,所述多个订阅关系对应所述目标资源的一个版本号。
- 根据权利要求37-44任一项所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同。
- 根据权利要求42所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求中还包括所述目标资源的丢失版本对应的订阅关系的标识信息。
- 根据权利要求43所述的设备,其特征在于,所述目标资源具有多个订阅关系,每个订阅关系对应所述目标资源的一个版本号,所述多个订阅关系对应所述目标资源的多个版本号不同;所述第一请求和所述第二请求中均包括所述目标资源的丢失版本对应的订阅关系的标识信息。
- 一种订阅设备,其特征在于,包括:处理器、存储器、与终端设备进行通信的接口;所述存储器存储计算机执行指令;所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如权利要求1至12中任一项所述的资源的订阅方法。
- 一种资源集合设备,其特征在于,包括:处理器、存储器、与终端设备进行通信的接口;所述存储器存储计算机执行指令;所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如权利要求13至24中任一项所述的资源的订阅方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现如权利要求1至12中任一项所述的资源的订阅方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现如权利要求13至24中任一项所述的资源的订阅方法。
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201980102011.1A CN114641974A (zh) | 2019-11-07 | 2019-11-07 | 资源的订阅方法、设备及存储介质 |
PCT/CN2019/116354 WO2021087892A1 (zh) | 2019-11-07 | 2019-11-07 | 资源的订阅方法、设备及存储介质 |
US17/737,939 US11909840B2 (en) | 2019-11-07 | 2022-05-05 | Resource subscription method, device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2019/116354 WO2021087892A1 (zh) | 2019-11-07 | 2019-11-07 | 资源的订阅方法、设备及存储介质 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/737,939 Continuation US11909840B2 (en) | 2019-11-07 | 2022-05-05 | Resource subscription method, device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021087892A1 true WO2021087892A1 (zh) | 2021-05-14 |
Family
ID=75848730
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/116354 WO2021087892A1 (zh) | 2019-11-07 | 2019-11-07 | 资源的订阅方法、设备及存储介质 |
Country Status (3)
Country | Link |
---|---|
US (1) | US11909840B2 (zh) |
CN (1) | CN114641974A (zh) |
WO (1) | WO2021087892A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114610740A (zh) * | 2022-05-12 | 2022-06-10 | 上海柯林布瑞信息技术有限公司 | 医疗数据平台的数据版本管理方法及装置 |
WO2024050698A1 (zh) * | 2022-09-06 | 2024-03-14 | Oppo广东移动通信有限公司 | 订阅请求方法、装置、设备及存储介质 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115061717B (zh) * | 2022-06-30 | 2023-09-05 | 北京亚控科技发展有限公司 | 应用管理方法、应用订阅方法及相关设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050160063A1 (en) * | 2003-05-16 | 2005-07-21 | International Business Machines Corporation | Method and system for distributing and updating heterogeneous resources |
CN103080931A (zh) * | 2010-06-28 | 2013-05-01 | 诺基亚公司 | 用于分页更新协议的方法和装置 |
CN104065517A (zh) * | 2014-07-07 | 2014-09-24 | 用友软件股份有限公司 | 分布式系统软件配置管理方法和系统 |
CN104639429A (zh) * | 2015-02-12 | 2015-05-20 | 青岛海尔智能家电科技有限公司 | 一种云平台的消息通知方法及装置 |
CN106559389A (zh) * | 2015-09-28 | 2017-04-05 | 阿里巴巴集团控股有限公司 | 一种服务资源发布、调用方法、装置、系统及云服务平台 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103220307B (zh) | 2012-01-19 | 2017-07-21 | 华为技术有限公司 | 订阅方法、订阅授权方法及Feeds生成服务器 |
CN103060931B (zh) | 2012-12-25 | 2015-09-23 | 浙江大东南集团有限公司 | 一种无喷头大面积连续纳米纤维静电纺丝装置 |
-
2019
- 2019-11-07 WO PCT/CN2019/116354 patent/WO2021087892A1/zh active Application Filing
- 2019-11-07 CN CN201980102011.1A patent/CN114641974A/zh active Pending
-
2022
- 2022-05-05 US US17/737,939 patent/US11909840B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050160063A1 (en) * | 2003-05-16 | 2005-07-21 | International Business Machines Corporation | Method and system for distributing and updating heterogeneous resources |
CN103080931A (zh) * | 2010-06-28 | 2013-05-01 | 诺基亚公司 | 用于分页更新协议的方法和装置 |
CN104065517A (zh) * | 2014-07-07 | 2014-09-24 | 用友软件股份有限公司 | 分布式系统软件配置管理方法和系统 |
CN104639429A (zh) * | 2015-02-12 | 2015-05-20 | 青岛海尔智能家电科技有限公司 | 一种云平台的消息通知方法及装置 |
CN106559389A (zh) * | 2015-09-28 | 2017-04-05 | 阿里巴巴集团控股有限公司 | 一种服务资源发布、调用方法、装置、系统及云服务平台 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114610740A (zh) * | 2022-05-12 | 2022-06-10 | 上海柯林布瑞信息技术有限公司 | 医疗数据平台的数据版本管理方法及装置 |
CN114610740B (zh) * | 2022-05-12 | 2022-08-16 | 上海柯林布瑞信息技术有限公司 | 医疗数据平台的数据版本管理方法及装置 |
WO2024050698A1 (zh) * | 2022-09-06 | 2024-03-14 | Oppo广东移动通信有限公司 | 订阅请求方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
US20220263920A1 (en) | 2022-08-18 |
US11909840B2 (en) | 2024-02-20 |
CN114641974A (zh) | 2022-06-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11909840B2 (en) | Resource subscription method, device, and storage medium | |
EP2696559B1 (en) | Method and Device for Resource Sharing Between Devices | |
US20110231557A1 (en) | Automatic Notification System and Process | |
CN115004673B (zh) | 消息推送方法、装置、电子设备及计算机可读介质 | |
WO2015081786A1 (zh) | 订阅通知的实现方法和装置 | |
KR101531532B1 (ko) | 원격 접속에 기초해 홈 네트워크 디바이스의 서비스를 이용하는 방법 및 장치 | |
US20220141311A1 (en) | Resource subscription method, device and server, and computer storage medium | |
TWI740210B (zh) | 終端設備管理方法及伺服器 | |
EP3174318B1 (en) | Method for realizing resource attribute notification, and common service entity | |
US11736557B1 (en) | Copying and pasting between devices | |
JP2006509391A (ja) | 構成ディスクリプションを通信するための構成識別子の使用 | |
US8176343B2 (en) | Method for providing information for power management of devices on a network | |
WO2020177020A1 (zh) | 物联网设备的发现方法、装置及终端设备 | |
CN107534598B (zh) | 一种媒体服务代理的方法、设备及系统 | |
WO2017136979A1 (zh) | 一种远程访问的实现方法、装置和系统 | |
JP4085394B2 (ja) | 通信端末装置及び通信方法 | |
WO2014180436A1 (zh) | 一种终端间进行通信的方法及终端 | |
CN104602047A (zh) | Epg数据的分享方法、服务器、终端及系统 | |
WO2016082492A1 (zh) | 一种原始资源通告的方法及相应的节点 | |
CN113051027A (zh) | 一种云管理系统的虚拟机流表信息发送方法及装置 | |
CN113037797A (zh) | 数据处理方法及其装置 | |
JP2006171917A (ja) | 無線マルチホップアドホックネットワークのためのプロトコル | |
WO2018010366A1 (zh) | 信息同步方法及装置 | |
GB2504725A (en) | Resource sharing between devices | |
WO2024152403A1 (zh) | 网络远程升级系统及方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19951852 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19951852 Country of ref document: EP Kind code of ref document: A1 |