CN113495797A - Message queue and consumer dynamic creation method and system - Google Patents

Message queue and consumer dynamic creation method and system Download PDF

Info

Publication number
CN113495797A
CN113495797A CN202110692394.1A CN202110692394A CN113495797A CN 113495797 A CN113495797 A CN 113495797A CN 202110692394 A CN202110692394 A CN 202110692394A CN 113495797 A CN113495797 A CN 113495797A
Authority
CN
China
Prior art keywords
consumer
tenant
message queue
service
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110692394.1A
Other languages
Chinese (zh)
Other versions
CN113495797B (en
Inventor
牛如兵
成圣昌
刘国亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Baiqiu Zhishang Network Service Co ltd
Original Assignee
Shanghai Baiqiu E Commerce Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Baiqiu E Commerce Co ltd filed Critical Shanghai Baiqiu E Commerce Co ltd
Priority to CN202110692394.1A priority Critical patent/CN113495797B/en
Publication of CN113495797A publication Critical patent/CN113495797A/en
Application granted granted Critical
Publication of CN113495797B publication Critical patent/CN113495797B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and a system for dynamically creating a message queue and a consumer, wherein the method comprises the following steps: s1: in the multi-tenant SaaS system, MQ dynamic configuration rules are constructed between each service project and each tenant, and the exclusive message queue and the consumers of each tenant are automatically established for each service project through self-defining message queue annotation on a sendDatak method body. According to the invention, the exclusive message queue of the tenant and the consumer are actively created and passively created, so that the reliability of the consumer service is improved and the throughput of the consumer service is improved while the data isolation between different tenants is ensured.

Description

Message queue and consumer dynamic creation method and system
Technical Field
The invention relates to the technical field of computers, in particular to a method and a system for dynamically creating a message queue and a consumer.
Background
SaaS, an abbreviated name of Software-as-a-Service, means Software as a Service, that is, providing a Software Service through a network. The SaaS platform supplier uniformly deploys the application software on the server of the SaaS platform supplier, a client can order the required application software service from a manufacturer through the Internet according to the actual working requirement, pay the cost to the manufacturer according to the ordered service and the time, and obtain the service provided by the Saas platform supplier through the Internet.
A Multi-Tenant (Multi tenance/Tenant) SaaS is a software system architecture, and realizes that one platform provides services for a plurality of tenants simultaneously. On the system architecture, a plurality of tenants share the same hardware configuration and application programs, and data isolation is realized. The application is designed to virtually partition its data, configuration, so that each tenant perceives itself as operating on a private, customizable application instance.
The existing e-commerce platform is developed based on a multi-tenant SaaS concept and aims to provide services for thousands of different tenants. The e-commerce platform can comprise a webpage service, a data service and a management service, wherein the webpage service is used for storing a page of a user browsing a commodity purchase tracking order, the data service is used for providing a series of data of commodities, users, orders, payment and the like for the webpage of the webpage service, and the management service is used for managing a series of data of commodities, users, orders, payment accounts and the like. User experience and throughput are improved through message queues in the e-commerce field.
The Message queue (Message queue) can store messages in the transmission process, so that the messages are sent by a Message sending party (or called a producer) and then are temporarily stored in the Message queue without being immediately delivered to a Message receiving party (or called a consumer), thereby realizing asynchronous communication between the Message sending party and the Message receiving party. The use of the message queue in the traditional e-commerce platform is that often a plurality of tenants share one message queue and one consumer, however, different tenants have different business demands, for example, the data volume of tenant a is large, the data volume of tenant B is small, and when the tenant a is too large and cannot be processed in a short time, the data of tenant B is always blocked in the queue and cannot be processed, which affects the user experience.
Disclosure of Invention
The embodiment of the application provides a message queue and consumer dynamic creation method and system, and solves the problem that in a multi-tenant SaaS system architecture in the prior art, when the service processing capacity of some tenants is too large, the service data of other tenants cannot be processed in time.
In a first aspect, an embodiment of the present application provides a method for dynamically creating a message queue and a consumer, including:
s1: in a multi-tenant SaaS system, establishing an MQ dynamic configuration rule between each service project and each tenant, and automatically creating an exclusive message queue and a consumer of each tenant for each service project by self-defining a message queue annotation on a sendDatak method body;
s2: monitoring a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset by each service project; according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of a user-defined message queue annotation used by the business project, and creating an exclusive message queue and a consumer for a newly added tenant in each business project; (ii) a
S3: when a newly added service project is initialized and started, a consumer method for automatically capturing the annotation of the used self-defined message queue by using a configuration class is used according to an MQ dynamic configuration rule, and a dedicated message queue and a consumer are generated for each tenant in the newly added service project.
Further, in the step S2, the method further includes, when a subject message for creating a new tenant is received, calling a create consumer interface, and annotating on a consuming method of a consumer class using the custom message queue.
Further, in the subject message of the new tenant created by the SaaS system, the subject message carries the unique identification Code of the new tenant, and the subject message is pushed into the queue to notify each service item of creating the exclusive message queue of the new tenant and the consumer.
Further, in the step S2, each service item creates a consumer interface by writing, simulates a process of RabbitMq registering a consumer to a Spring container, and splices the unique identification Code of the new tenant in front of the queue name and RouteKey, so as to generate a dedicated message queue and a consumer for the new tenant.
Further, in the step S3, the automatically capturing, by using the configuration class, the consumer method annotated with the custom message queue includes using the custom message queue annotation on a consumer method in the consumer class of the newly added service item, and querying the unique identifier Code of all tenants in the SaaS system through the configuration class of the SpringBoot framework.
Further, the step S3 further includes scanning all methods in all classes in all the service items, finding out a consumer method annotated by using the custom message queue, and obtaining a queue name and a RouteKey carried in the annotation; and simulating the process of registering the consumer to a Spring container by the RabbitMq, and splicing the unique identification Code of the tenant before the queue name and the RouteKey so as to generate a special consumer for each tenant in the newly added service project.
In a second aspect, an embodiment of the present application provides a message queue and consumer dynamic creation system, where the method in the first aspect is adopted, and includes: the system comprises a rule configuration module, a first creation module and a second creation module, wherein the rule configuration module is respectively connected with the first creation module and the second creation module;
the rule configuration module is configured to construct MQ dynamic configuration rules for each service project and each tenant in a multi-tenant SaaS system, and automatically create an exclusive message queue and a consumer of each tenant for each service project by self-defining a message queue annotation on a sendDatak method body;
the first creation module is configured to monitor a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset by each service project; according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of a user-defined message queue annotation used by the business project, and creating an exclusive message queue and a consumer for a newly added tenant in each business project;
and the second creation module is configured to generate an exclusive message queue and a consumer for each tenant in the newly added service project by utilizing a consumer method for automatically capturing the annotation of the used custom message queue by using a configuration class according to an MQ dynamic configuration rule when the newly added service project is initialized and started.
Further, the system also comprises a tenant adding module, and the tenant adding module is connected with the first creating module; the tenant adding module is configured to create a new tenant in the SaaS system, and push a theme message of the added tenant to the first creating module.
Further, the system also comprises a service adding module, wherein the service adding module is connected with the second establishing module; and the service adding module is configured to create a new service item in the RabbitMq message queue and push the new service item to the second creating module for configuration.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including a memory and a processor; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps of the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer-readable storage medium for storing computer instructions for a message-passing apparatus of a message-middleware, which contains computer instructions for executing the message-passing method of the message-middleware in the first aspect.
The technical scheme provided in the embodiment of the application has at least the following technical effects:
(1) the problem of throughput blocking of the SaaS system in the traditional message queue design is solved, the message queue MQ technology is utilized, the exclusive message queue and the consumers are dynamically established for each tenant in the multi-tenant SaaS system, data isolation among different tenants is guaranteed, and meanwhile reliability of consumer service is improved and throughput of the consumer service is improved.
(2) After the MQ dynamic configuration rule in the technical scheme is utilized, developers do not need to write codes for all tenants respectively, only need to set the MQ dynamic configuration rule, and directly create an exclusive message queue and consumers of the tenants corresponding to the service project when the tenants or the service project is newly added, so that a solution for data isolation in the message queue is provided by using a simple configuration rule on the premise of reducing the workload of the developers.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Fig. 1 is a flowchart of a method for dynamically creating a message queue and a consumer in embodiment 1 of the present application;
fig. 2 is a schematic structural diagram of a multi-tenant SaaS system in embodiment 1 of the present application;
fig. 3 is an architecture diagram of a connection relationship between a multi-tenant and a business project in embodiment 1 of the present application;
fig. 4 is a connection relationship architecture diagram between multiple tenants and a single business project in embodiment 1 of the present application;
fig. 5 is a diagram illustrating an architecture of a connection relationship between a single tenant and a plurality of service items in embodiment 1 of the present application;
fig. 6 is a block diagram of a system for dynamically creating a message queue and a consumer in embodiment 2 of the present application.
Detailed Description
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
The scientific and technical terms involved in the invention are explained as follows:
SaaS: software is a service; MQ: a message queue; RabbitMQ: message queue middleware; spring: a Spring frame; RouteKey: routing matching keywords; code: a unique identification code of the tenant; spring boot: spring boot frame.
The embodiment of the application provides a message queue and consumer dynamic creation method and system, and solves the problem that in a multi-tenant SaaS system architecture in the prior art, when the service processing capacity of some tenants is too large, the service data of other tenants cannot be processed in time. In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Example 1
Referring to fig. 1, a flowchart of a method for dynamically creating a message queue and a consumer according to an embodiment of the present application is shown.
Step S1: in the multi-tenant SaaS system, MQ dynamic configuration rules are constructed between each service project and each tenant, and the exclusive message queue and the consumers of each tenant are automatically established for each service project through self-defining message queue annotation on a sendDatak method body.
The embodiment utilizes a message queue technology and improves a data transmission mode based on a multi-tenant system. Referring to fig. 2, an architecture diagram applicable to the multi-tenant SaaS system is shown. And the plurality of tenants transmit the data to the database through the Web Server for storage, so as to provide services. The embodiment is based on the improvement and optimization of data transmission and throughput in a multi-tenant SaaS system. Referring to fig. 3-5, the connection relationship between the multi-tenant and the business project, which is applicable to the embodiment of the present application, is shown.
The sendTask methodology represents that when any one of the service project and the tenant dynamically changes, the dedicated message queue and the consumer of each tenant are automatically created for each service project according to the user-defined message queue annotation. Referring to fig. 4 and 5, when a tenant is newly added, a dedicated message queue and a consumer of the newly added tenant are created for each service item, and when a service item is newly added, a dedicated message queue and a consumer of all tenants in the newly added service item are created for the newly added service item.
Step S2: monitoring a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset by each service project; and according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of the user-defined message queue annotation used by the service project, and creating an exclusive message queue and a consumer for the newly added tenant in each service project.
In this embodiment, the subject message of the new tenant created by the SaaS system carries the unique identification Code of the new tenant, and is pushed into the queue to notify each service item of creating the dedicated message queue of the new tenant and the consumer. Certainly, the message queue and the consumer bound by the existing tenant also carry the displacement identification Code of the tenant.
In step S2, the method further includes calling a create consumer interface when a subject message of creating a new tenant is received, and annotating on a consuming method of a consumer class using the custom message queue. I.e. MQ dynamic configuration rules are set in the consumer-like consumption method.
In step S2, each business project creates a consumer interface by writing, simulates a process of registering a consumer to a Spring container by the RabbitMq, and splices the unique identification Code of the new tenant in front of the queue name and RouteKey, thereby generating an exclusive message queue and the consumer for the new tenant. Furthermore, an interface for creating a consumer is compiled in the step, the process that a message queue middleware RabbitMq registers the consumer to a Spring frame container is simulated, and a unique identification Code of the tenant is spliced before a queue name and a route are matched with a keyword RouteKey, so that an exclusive message queue and the consumer are created for the newly added tenant in each service item.
In step S2, it is mainly shown that, when a tenant is newly added, a connection relationship between each service item and the newly added tenant is actively created according to the MQ dynamic configuration rule, that is, an exclusive message queue and a consumer are created for the newly added tenant, so that when the information of the newly added tenant is accessed through the SaaS system, the corresponding service item can be quickly processed directly through the exclusive message queue and the consumer.
Further, the step of proactively creating tenant-specific message queues and consumers may include:
s21: and writing a custom message queue annotation, wherein the annotation carries a queue name and a RouteKey for later establishing a queue and a consumer.
S22: when a tenant is newly added, a theme message for creating the new tenant is pushed to the queue, the message carries the unique identification Code of the new tenant, and each service project is notified to create a consumer. The code is as follows:
public void initMessageListenerContainerForCreateTenant(String tenantCode){try{ConnectionFactory connectionFactory=getRabbitConnectionFactory();RabbitAdmin rabbitAdmin=getRabbitAdmin();AbstractRabbitListenerContainerFactory simpleRabbitListenerContainerFactory=getRabbitListenerContainerFactory(connectionFactory);
RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry=new RabbitListenerEndpointRegistry();rabbitListenerEndpointRegistry.start();
RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar=new RabbitListenerEndpointRegistrar();
Set<String>queueNameSet=new HashSet<>();
Method[]declaredMethods=null;CustomRabbitListener customRabbitListener=null;RabbitListenerEnum rabbitListenerConfig=null;String className=null;String methodName=null;Object bean=null;String queueName=null;String routeKey=null;
String simpleRabbitListenerEndpointId=null;Queue queue=null;SimpleRabbitListenerEndpoint simpleRabbitListenerEndpoint=null;Set<Class<?>>classSet=ClassUtil.scanPackage("com.ibaiqiu");
……
s23: and compiling a monitoring consumer in each business project for monitoring the message of creating a new tenant, calling an interface of the creating consumer when receiving the message, and annotating on a consumption method in the consumer class by using a self-defined message queue.
S24: writing an interface for creating a consumer, simulating the process of registering the consumer to a Spring container by the RabbitMq, and splicing a unique identification Code of the tenant in front of the queue name and the RouteKey so as to generate a special consumer for the new tenant.
And creating a new tenant in the SaaS, wherein the new tenant comprises a plurality of tenant information including a unique identification code, a name, an abbreviation, a state and a function authority of the new tenant, and the function authority comprises a platform, content, commodities, marketing, orders and the like used by the tenant. After the creation is completed, the SaaS system automatically pushes the subject message for creating the new tenant to all queues, after the queues receive the message, an interface for creating the consumer is called, a process that a RabbitMq (message queue middleware) registers the consumer to a Spring frame container is simulated, a unique identification Code of the tenant is spliced in front of a queue name and a routeKey (routing matching keyword), a dedicated consumer is generated for the new tenant, and all data of the test merchant 1 are pushed to the queues with the prefixes of the unique identification codes.
Step S3: when the newly added service project is initialized and started, a consumer method for automatically capturing the annotation of the used self-defined message queue by using the configuration class is utilized according to the dynamic configuration rule of the MQ, and a dedicated message queue and consumers are generated for each tenant in the newly added service project.
In step S3, the method for automatically capturing a customer annotated with a custom message queue using a configuration class includes using the custom message queue annotation on a consuming method in a customer class of a new service item, and querying a unique identifier Code of all tenants in the SaaS system through the configuration class of the springbook framework.
Step S3 further includes scanning all methods under all classes in all business projects, finding out consumer method using self-defined message queue annotation, and obtaining queue name and RouteKey carried in annotation; simulating the process of registering the consumer to a Spring container by the RabbitMq, and splicing the unique identification Code of the tenant before the queue name and the RouteKey so as to generate a special consumer for each tenant in a newly added service project.
Step S3 in this embodiment is a message queue and consumer passive creation process, which may include the following steps.
S31: writing a custom message queue annotation, using the custom message queue annotation on a consumption method in a consumer class, wherein the annotation carries a queue name and a RouteKey and is used for creating a message queue and a consumer later.
The following code represents the use of custom message queue annotations on consuming methods in the consumer class.
@Component
public class UserLoginLogSaveListener{
private static final String IP_ADDRESS_ANALYSIS_URL="http://whois.pconline.com.cn/ipJson.jspjson=true&ip=";
private static final String IP_ADDRESS_AREA="addr";
private static final String UNKNOWN _ IP _ ADDRESS _ AREA ═ UNKNOWN;
@Autowired
private UserLoginLogDao userLoginLogDao;
@ManualAck(requeue=false)
@CustomRabbitListener(rabbitListenerConfig=RabbitListenerEnum.USER_LOGIN_LOG_SAVE_LISTENER)
public void saveUserLoginLog(Message message,Channel channel)throws Exception{
UserLoginLog userLoginLog=JSONObject.parseObject(message.getBody(),UserLoginLog.class);
String ipAddress=userLoginLog.getIpAddress();
AssertUtil.fastAssert(ReturnCode.USER_IP_ADDRESS_IS_NULL,ipAddress);
Map<String,String>resultMap=HttpClientUtils.getResult(IP_ADDRESS_ANALYSIS_URL+ipAddress,new TypeReference<Map<String,String>>(){});
if(AssertUtil.isNull(resultMap)||AssertUtil.isNull(resultMap.get(IP_ADDRESS_AREA)))
{userLoginLog.setIpAddressArea(UNKNOWN_IP_ADDRESS_AREA);}else
{userLoginLog.setIpAddressArea(resultMap.get(IP_ADDRESS_AREA));}userLoginLogDao.insertSelective(userLoginLog);}}
s32: writing a Springboot configuration class, and inquiring the unique identification codes of all tenants in the SaaS system.
Writing the code of the Springboot configuration class as follows:
“@Component@Order(value=2)private class InitMessageListenerContainer implements CommandLineRunner{@Overridepublic void run(String...args)throws Exception{try{ConnectionFactory connectionFactory=getRabbitConnectionFactory();RabbitAdmin rabbitAdmin=getRabbitAdmin();AbstractRabbitListenerContainerFactory simpleRabbitListenerContainerFactory=getRabbitListenerContainerFactory(connectionFactory);
RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry=newRabbitListenerEndpointRegistry();rabbitListenerEndpointRegistry.start();RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar=new RabbitListenerEndpointRegistrar();DynamicDataSource.setDataSource(Constant.DataSource.PLATFORM_DATASOURCE);
List<String>tenantCodeList=tenantDao.getTenantCodeList();”。
s33: all methods under all classes in the business project are scanned, a consumer method using the user-defined message queue annotation is found, and the queue name and RouteKey carried in the annotation are obtained.
In the multi-data source mode, the code is determined to be "if" (rabbitlistenerum. multiple data source mode. on ═ rabbitlistenerconfig. get multiple data source mode () ".
Further, a multi-data source mode is started, all tenants are traversed, tenant codes are spliced in front of queue names and routing keys to generate corresponding consumers for each tenant, and Code analysis is as follows:
“for(String tenantCode:tenantCodeList){queueName=(rabbitListenerConfig.getMultipleNodeMode()?ipAddressPrefix:StrUtil.EMPTY)+tenantCode+StrUtil.DOT+rabbitListenerConfig.getQueue();routeKey=tenantCode+StrUtil.DOT+rabbitListenerConfig.getRouteKey();simpleRabbitListenerEndpointId=(rabbitListenerConfig.getMultipleNodeMode()?ipAddressPrefix:StrUtil.EMPTY)+tenantCode+StrUtil.DOT+className+StrUtil.DOT+methodName;registerListenerContainer(queueNameSet,queueName,queue,rabbitAdmin,rabbitListenerConfig,routeKey,simpleRabbitListenerEndpoint,simpleRabbitListenerEndpointId,method,bean,simpleRabbitListenerContainerFactory,rabbitListenerEndpointRegistry);}”。
aiming at a mode without opening multiple data sources, no splicing is carried out, consumers are directly generated, and code analysis is as follows:
“queueName=(rabbitListenerConfig.getMultipleNodeMode()?ipAddressPrefix:StrUtil.EMPTY)+rabbitListenerConfig.getQueue();routeKey=rabbitListenerConfig.getRouteKey();simpleRabbitListenerEndpointId=(rabbitListenerConfig.getMultipleNodeMode()?ipAddressPrefix:StrUtil.EMPTY)+className+StrUtil.DOT+methodName;registerListenerContainer(queueNameSet,queueName,queue,rabbitAdmin,rabbitListenerConfig,routeKey,simpleRabbitListenerEndpoint,simpleRabbitListenerEndpointId,method,bean,simpleRabbitListenerContainerFactory,rabbitListenerEndpointRegistry);”。
s34: simulating the process of registering the consumers to the Spring container by the Rabbi tMq, and splicing the unique identification Code of the tenant in front of the queue name and the RouteKey so as to generate a special consumer for each tenant.
Example 2
Referring to fig. 6, an embodiment of the present application provides a message queue and consumer dynamic creation system, which employs the method as in embodiment 1, and includes a rule configuration module 100, a first creation module 200, and a second creation module 300, where the rule configuration module 100 is connected to the first creation module 200 and the second creation module 300, respectively.
The rule configuration module 100 is configured to construct MQ dynamic configuration rules for each service project and each tenant in the multi-tenant SaaS system, and automatically create an exclusive message queue and a consumer for each service project by self-defining a message queue annotation on the sendTask method body.
The first creating module 200 is configured to monitor a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset for each service project; and according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of the user-defined message queue annotation used by the service project, and creating an exclusive message queue and a consumer for the newly added tenant in each service project.
The second creating module 300 is configured to generate a dedicated message queue and a consumer for each tenant in the newly added service project by using a consumer method for automatically capturing the used custom message queue annotation by using a configuration class according to the MQ dynamic configuration rule when the newly added service project is initialized and started.
The embodiment further includes a tenant adding module 400, and the tenant adding module 400 is connected to the first creating module 200; the tenant adding module 400 is configured to create a new tenant in the SaaS system, and push a subject message of the added tenant to the first creating module 200.
The embodiment further includes a service adding module 500, where the service adding module 500 is connected to the second creating module 300; the service adding module 500 is configured to create a new service item in the Rabbi tMq message queue, and push the new service item to the second creating module 300 for configuration.
Example 3
The embodiment provides an electronic device, comprising a memory and a processor; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps of embodiment 1.
The present embodiment provides a computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the method steps of embodiment 1.
Improvements to a technology can clearly be distinguished between hardware improvements (e.g. improvements to the circuit structure of diodes, transistors, switches, etc.) and software improvements (improvements to the process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core unity Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, HDL, pamm, hard Language (Hardware Description Language), and vhjhdl (Hardware Description Language), which are currently used by Hardware compiler 2. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (trans) such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (9)

1. A message queue and consumer dynamic creation method is characterized by comprising the following steps:
s1: in a multi-tenant SaaS system, establishing an MQ dynamic configuration rule between each service project and each tenant, and automatically creating an exclusive message queue and a consumer of each tenant for each service project by self-defining a message queue annotation on a sendDatak method body;
s2: monitoring a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset by each service project; according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of a user-defined message queue annotation used by the business project, and creating an exclusive message queue and a consumer for a newly added tenant in each business project;
s3: when a newly added service project is initialized and started, a consumer method for automatically capturing the annotation of the used self-defined message queue by using a configuration class is used according to an MQ dynamic configuration rule, and a dedicated message queue and a consumer are generated for each tenant in the newly added service project.
2. The message queue and consumer dynamic creation method of claim 1, further comprising in step S2, upon receiving a subject message to create a new tenant, invoking a create consumer interface and annotating with the custom message queue on a consuming method of a consumer class.
3. The message queue and consumer dynamic creation method of claim 1, wherein a subject message of a new tenant created by the SaaS system carries a unique identification Code of the new tenant, and notifies each business item of creating an exclusive message queue and consumer of the new tenant by pushing the unique identification Code into the queue.
4. The method as claimed in claim 3, wherein in step S2, each service item simulates RabbitMq registration of a consumer to a Spring container by writing a create consumer interface, and concatenates the unique identifier Code of a new tenant before the queue name and RouteKey, so as to generate a dedicated message queue and consumer for the new tenant.
5. The method for dynamically creating a message queue and a consumer according to claim 3, wherein in the step S3, the method for automatically capturing a consumer annotated with the custom message queue by using a configuration class includes using the custom message queue annotation on a consumer method in the consumer class of the newly added business item, and querying a unique identifier Code of all tenants in the SaaS system through the configuration class of a SpringBoot framework.
6. The message queue and consumer dynamic creation method of claim 5, wherein the step S3 further comprises scanning all methods under all classes in all the business items, finding out consumer methods annotated with the custom message queue, obtaining a queue name and a RouteKey carried in the annotation; and simulating the process of registering the consumer to a Spring container by the RabbitMq, and splicing the unique identification Code of the tenant before the queue name and the RouteKey so as to generate a special consumer for each tenant in the newly added service project.
7. A message queue and consumer dynamic creation system employing the method of claims 1-6, comprising: the system comprises a rule configuration module, a first creation module and a second creation module, wherein the rule configuration module is respectively connected with the first creation module and the second creation module;
the rule configuration module is configured to construct MQ dynamic configuration rules for each service project and each tenant in a multi-tenant SaaS system, and automatically create an exclusive message queue and a consumer of each tenant for each service project by self-defining a message queue annotation on a sendDatak method body;
the first creation module is configured to monitor a subject message of a new tenant created by the SaaS system according to a consumer monitoring class preset by each service project; according to the MQ dynamic configuration rule and the monitored subject message, scanning a consumer method of a user-defined message queue annotation used by the business project, and creating an exclusive message queue and a consumer for a newly added tenant in each business project;
and the second creation module is configured to generate an exclusive message queue and a consumer for each tenant in the newly added service project by utilizing a consumer method for automatically capturing the annotation of the used custom message queue by using a configuration class according to an MQ dynamic configuration rule when the newly added service project is initialized and started.
8. The message queue and consumer dynamic creation system of claim 7, further comprising a tenant add module, the tenant add module being connected with the first creation module; the tenant adding module is configured to create a new tenant in the SaaS system, and push a theme message of the added tenant to the first creating module.
9. The message queue and consumer dynamic creation system of claim 7, further comprising a service addition module, the service addition module being connected to the second creation module; and the service adding module is configured to create a new service item in the RabbitMq message queue and push the new service item to the second creating module for configuration.
CN202110692394.1A 2021-06-22 2021-06-22 Message queue and consumer dynamic creation method and system Active CN113495797B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110692394.1A CN113495797B (en) 2021-06-22 2021-06-22 Message queue and consumer dynamic creation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110692394.1A CN113495797B (en) 2021-06-22 2021-06-22 Message queue and consumer dynamic creation method and system

Publications (2)

Publication Number Publication Date
CN113495797A true CN113495797A (en) 2021-10-12
CN113495797B CN113495797B (en) 2023-03-07

Family

ID=77997857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110692394.1A Active CN113495797B (en) 2021-06-22 2021-06-22 Message queue and consumer dynamic creation method and system

Country Status (1)

Country Link
CN (1) CN113495797B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114035899A (en) * 2021-11-15 2022-02-11 中原银行股份有限公司 Cross-cluster parameter configuration method and device and electronic equipment
CN114710311A (en) * 2022-02-11 2022-07-05 浙江高信技术股份有限公司 Multi-project message management method and system
CN114726809A (en) * 2022-06-10 2022-07-08 北京沃丰时代数据科技有限公司 Multi-tenant routing method, device, equipment, storage medium and program product
CN115297066A (en) * 2022-07-23 2022-11-04 杭州半云科技有限公司 Resource dynamic cooperation method, device, server and medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080115147A1 (en) * 2006-11-15 2008-05-15 Ricoh Corporation Ltd. Device architecture to support multiple protocols
US20130024524A1 (en) * 2011-07-21 2013-01-24 Parlant Technology, Inc. Targeted messaging system and method
CN103636166A (en) * 2011-07-06 2014-03-12 国际商业机器公司 Dynamic data-protection policies associated with a request-reply message queuing environment
CN106933589A (en) * 2017-03-13 2017-07-07 车智互联(北京)科技有限公司 A kind of message queue component based on configuration and its integrated method
CN108021458A (en) * 2017-12-01 2018-05-11 天津麒麟信息技术有限公司 A kind of multi-tenant audit indexing means based on message trigger
CN110032459A (en) * 2019-04-22 2019-07-19 深圳乐信软件技术有限公司 Message queue configuration method, device, computer equipment and storage medium
CN110262909A (en) * 2019-06-21 2019-09-20 李翀 RabbitMQ multi-zone supervision and message dilivery method, system
CN110333956A (en) * 2019-05-23 2019-10-15 平安普惠企业管理有限公司 Message storage method, device, medium and electronic equipment in message queue
US10713664B1 (en) * 2019-03-22 2020-07-14 International Business Machines Corporation Automated evaluation and reporting of microservice regulatory compliance
CN111488224A (en) * 2020-03-30 2020-08-04 武汉时波网络技术有限公司 Distributed metering charging method and system
CN112100262A (en) * 2020-09-16 2020-12-18 南京智数云信息科技有限公司 Method and system for quickly building and dynamically expanding multi-tenant software as a service (SaaS) platform

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080115147A1 (en) * 2006-11-15 2008-05-15 Ricoh Corporation Ltd. Device architecture to support multiple protocols
CN103636166A (en) * 2011-07-06 2014-03-12 国际商业机器公司 Dynamic data-protection policies associated with a request-reply message queuing environment
US20130024524A1 (en) * 2011-07-21 2013-01-24 Parlant Technology, Inc. Targeted messaging system and method
CN106933589A (en) * 2017-03-13 2017-07-07 车智互联(北京)科技有限公司 A kind of message queue component based on configuration and its integrated method
CN108021458A (en) * 2017-12-01 2018-05-11 天津麒麟信息技术有限公司 A kind of multi-tenant audit indexing means based on message trigger
US10713664B1 (en) * 2019-03-22 2020-07-14 International Business Machines Corporation Automated evaluation and reporting of microservice regulatory compliance
CN110032459A (en) * 2019-04-22 2019-07-19 深圳乐信软件技术有限公司 Message queue configuration method, device, computer equipment and storage medium
CN110333956A (en) * 2019-05-23 2019-10-15 平安普惠企业管理有限公司 Message storage method, device, medium and electronic equipment in message queue
CN110262909A (en) * 2019-06-21 2019-09-20 李翀 RabbitMQ multi-zone supervision and message dilivery method, system
CN111488224A (en) * 2020-03-30 2020-08-04 武汉时波网络技术有限公司 Distributed metering charging method and system
CN112100262A (en) * 2020-09-16 2020-12-18 南京智数云信息科技有限公司 Method and system for quickly building and dynamically expanding multi-tenant software as a service (SaaS) platform

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
SAGAR ARORA; PANTELIS A. FRANGOUDIS; ADLEN KSENTINI: "Exposing radio network information in a MEC-in-NFV environment: the RNISaaS concept", 《IEEE XPLORE》 *
姜晓燕等: "基于模型驱动的分层多租户架构设计", 《小型微型计算机系统》 *
王利文等: "ESB支持的SaaS应用动态互操作方法", 《合肥工业大学学报(自然科学版)》 *
苏志宏: "基于ActiveMQ通信的多租户任务调度框架设计与实现", 《电脑知识与技术》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114035899A (en) * 2021-11-15 2022-02-11 中原银行股份有限公司 Cross-cluster parameter configuration method and device and electronic equipment
CN114035899B (en) * 2021-11-15 2022-10-25 中原银行股份有限公司 Cross-cluster parameter configuration method and device and electronic equipment
CN114710311A (en) * 2022-02-11 2022-07-05 浙江高信技术股份有限公司 Multi-project message management method and system
CN114710311B (en) * 2022-02-11 2024-01-02 浙江高信技术股份有限公司 Multi-project message management method and system
CN114726809A (en) * 2022-06-10 2022-07-08 北京沃丰时代数据科技有限公司 Multi-tenant routing method, device, equipment, storage medium and program product
CN114726809B (en) * 2022-06-10 2022-09-20 北京沃丰时代数据科技有限公司 Multi-tenant routing method, device, equipment, storage medium and program product
CN115297066A (en) * 2022-07-23 2022-11-04 杭州半云科技有限公司 Resource dynamic cooperation method, device, server and medium
CN115297066B (en) * 2022-07-23 2023-03-28 杭州半云科技有限公司 Resource dynamic cooperation method, device, server and medium

Also Published As

Publication number Publication date
CN113495797B (en) 2023-03-07

Similar Documents

Publication Publication Date Title
CN113495797B (en) Message queue and consumer dynamic creation method and system
CN109597661B (en) Service function configuration method and device
CN107239479B (en) Block chain based data storage and query method and device
CN108173706B (en) Service marking method, device and equipment under multi-service system
CN109062563B (en) Method and device for generating page
CN108599973B (en) Log association method, device and equipment
CN110673839B (en) Distributed tool configuration construction generation method and system
US11089000B1 (en) Automated source code log generation
CN107943465B (en) Method and device for generating HTML (Hypertext markup language) form
US10834059B2 (en) Secure message handling of an application across deployment locations
US20200097553A1 (en) Cognitive translation service integrated with context-sensitive derivations for determining program-integrated information relationships
WO2023000952A1 (en) Mailbox-based bill processing
US11194783B2 (en) Multiple parameter based composite rule wise data validation in cloud hybrid model
CN107133160B (en) Server and client
US11093292B2 (en) Identifying recurring actions in a hybrid integration platform to control resource usage
US10803246B2 (en) Decomposing composite product reviews
US20180052754A1 (en) Performance metric contextualization in a distributed computing environment
CN113296740A (en) Service object processing method, device, equipment and machine readable medium
US20200409670A1 (en) Automatic software generation for computer systems
CN106548331B (en) Method and device for determining release sequence
CN112181407B (en) Service realization processing method, device, system, electronic equipment and storage medium
CN114327941A (en) Service providing method and device
CN112596781A (en) Service execution and service configuration method and device
CN112598461A (en) Cloud product delivery method, device and medium
CN113448960A (en) Method and device for importing form file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 200335 floor 2, building B, No. 1358 Xiehe Road, Changning District, Shanghai

Applicant after: Shanghai baiqiu new online commerce Digital Technology Co.,Ltd.

Address before: 200335 room 2403, floor 1, building 8, No. 33, Guangshun Road, Changning District, Shanghai

Applicant before: Shanghai baiqiu e-commerce Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20231116

Address after: Room 701, Building B, No. 1358 Xiehe Road, Changning District, Shanghai, 200050

Patentee after: Shanghai Baiqiu Zhishang Network Service Co.,Ltd.

Address before: 200335 floor 2, building B, No. 1358 Xiehe Road, Changning District, Shanghai

Patentee before: Shanghai baiqiu new online commerce Digital Technology Co.,Ltd.

TR01 Transfer of patent right