CN113795001B - Method and device for sending system short messages based on SPI - Google Patents
Method and device for sending system short messages based on SPI Download PDFInfo
- Publication number
- CN113795001B CN113795001B CN202111101924.7A CN202111101924A CN113795001B CN 113795001 B CN113795001 B CN 113795001B CN 202111101924 A CN202111101924 A CN 202111101924A CN 113795001 B CN113795001 B CN 113795001B
- Authority
- CN
- China
- Prior art keywords
- service
- short message
- interface
- loading
- standard
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000012545 processing Methods 0.000 claims abstract description 36
- 238000012795 verification Methods 0.000 claims description 4
- 238000011161 development Methods 0.000 abstract description 9
- 230000008859 change Effects 0.000 abstract description 5
- 230000007246 mechanism Effects 0.000 abstract description 3
- 238000004590 computer program Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 238000010276 construction Methods 0.000 description 6
- 239000008186 active pharmaceutical agent Substances 0.000 description 5
- 239000000243 solution Substances 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000003860 storage Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000002347 injection Methods 0.000 description 1
- 239000007924 injection Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000004043 responsiveness Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/12—Messaging; Mailboxes; Announcements
- H04W4/14—Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/30—Authentication, i.e. establishing the identity or authorisation of security principals
- G06F21/31—User authentication
-
- 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/01—Protocols
- H04L67/133—Protocols for remote procedure calls [RPC]
-
- 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/2866—Architectures; Arrangements
- H04L67/30—Profiles
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2133—Verifying human interaction, e.g., Captcha
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明属于互联网技术领域,具体涉及一种基于SPI进行系统短信发送的方法及装置。The invention belongs to the technical field of the Internet, and in particular relates to a method and a device for sending system short messages based on SPI.
背景技术Background technique
随着移动互联网技术的不断发展,传统的API都是调用方依赖接口的实现来实现业务使用,业务场景的多样化和复杂化,促用我们在生产应用,需要来实现框架扩展和组件替换。国际海外系统在每应用一个国家后为了快速的响应用户使用运营商的短信功能,但是现有技术存在以下为:一、每次新增一个运营商都需要重新去编写应用系统的代码,调用对应的API接口。二、每一次调整都需要从编码、调试、测试、部署这些环节都要去做。三、当我们海外系统新增一个国家进行运行时,在业务场景不变的情况,我们仅因为短信服务都需要重新实现一遍。With the continuous development of mobile Internet technology, the traditional API is that the caller relies on the implementation of the interface to achieve business use. The diversification and complexity of business scenarios prompt us to implement framework expansion and component replacement in production applications. The international overseas system is used in each country in order to quickly respond to the user's use of the operator's SMS function, but the existing technology has the following: 1. Every time a new operator is added, it is necessary to re-write the code of the application system and call the corresponding API interface. Second, every adjustment needs to be done from coding, debugging, testing, and deployment. 3. When a new country is added to our overseas system for operation, and the business scenario remains unchanged, we need to re-implement it just because of the SMS service.
综上所述,传统做法需要代码耦合度强,调试成本高,不确定性较多;传统的条件路由判断会加非常多的冗余代码;每次加一个新的国家都需要去重新编译、打包、部署这样流程,整个流程较长导致效率较低,且过程中不可控因素较多,且很容易造成意外引起风险。To sum up, the traditional approach requires strong code coupling, high debugging costs, and more uncertainty; traditional conditional routing judgments will add a lot of redundant code; every time a new country is added, it needs to be recompiled, The whole process of packaging and deployment is long, resulting in low efficiency, and there are many uncontrollable factors in the process, and it is easy to cause accidents and risks.
发明内容Contents of the invention
有鉴于此,本发明的目的在于克服现有技术的不足,提供一种基于SPI进行系统短信发送的方法及装置,以解决现有技术中系统短信发送效率低且风险高的问题。In view of this, the purpose of the present invention is to overcome the deficiencies of the prior art, and provide a method and device for sending system short messages based on SPI, so as to solve the problem of low efficiency and high risk of system short message sending in the prior art.
为实现以上目的,本发明采用如下技术方案:一种基于SPI进行系统短信发送的方法,包括:In order to achieve the above object, the present invention adopts the following technical solutions: a method for sending system short messages based on SPI, comprising:
构建标准短信接口并实例化;Build a standard SMS interface and instantiate it;
基于所述标准短信接口进行处理以实现不同应用业务场景的需求;Processing based on the standard SMS interface to meet the requirements of different application business scenarios;
所述构建标准短信接口并实例化,包括:Described construction standard SMS interface and instantiation, including:
通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;Judge the scope of the business domain to which it belongs and the corresponding interface call template by applying the business scenario, and judge the service that needs to be called to trigger the call of the SMS device and build a standard call interface;
构建新的服务加载器并根据所述服务加载器构建加载类处理对象;Constructing a new service loader and constructing a loading class processing object according to the service loader;
遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。Traversing all the services in the configuration file and instantiating the classes in the configuration file through reflective loading.
进一步的,所述应用业务场景包括:Further, the application business scenario includes:
取件短信、催提短信以及用户登录验证码。Retrieval text messages, reminder text messages and user login verification codes.
进一步的,所述根据所述服务加载器构建加载类处理对象,包括:Further, the constructing the loading class processing object according to the service loader includes:
通过传入的所述服务加载器,利用java提供的内部API构建新的后加载的迭代器。Through the incoming service loader, use the internal API provided by java to construct a new post-loaded iterator.
进一步的,所述将配置文件中类反射加载进行实例化,包括:Further, the class reflection loading in the configuration file is instantiated, including:
将配置文件中所有配置类信息,通过反射加载实例化并且加载到缓存中去。Instantiate and load all configuration class information in the configuration file into the cache through reflective loading.
进一步的,所述基于所述标准短信接口进行处理以实现不同应用业务场景的需求,包括:Further, the processing based on the standard SMS interface to meet the requirements of different application business scenarios includes:
根据不同国家的运营商提供的服务器地址、报文的格式以及对应的协议将寻消息内容进行推送。Push the message content according to the server address, message format and corresponding protocol provided by operators in different countries.
本申请实施例提供一种基于SPI进行系统短信发送的装置,包括:The embodiment of the present application provides a device for sending system short messages based on SPI, including:
构建模块,用于构建标准短信接口并实例化;A building block, used to build a standard SMS interface and instantiate it;
处理模块,用于基于所述标准短信接口进行处理以实现不同应用业务场景的需求;A processing module, configured to perform processing based on the standard SMS interface to meet the requirements of different application business scenarios;
所述构建模块,包括:The building blocks include:
判断单元,用于通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;The judging unit is used to judge the scope of the business domain to which it belongs and the corresponding interface calling template through the application business scenario, and judge the service that needs to be called to trigger calling the short message device and construct a standard calling interface;
构建单元,用于构建新的服务加载器并根据所述服务加载器构建加载类处理对象;A construction unit for constructing a new service loader and constructing a loading class processing object according to the service loader;
加载单元,用于遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。The loading unit is used to traverse all the services in the configuration file and instantiate the classes in the configuration file by reflective loading.
本发明采用以上技术方案,能够达到的有益效果包括:The present invention adopts the above technical scheme, and the beneficial effects that can be achieved include:
本发明提供一种基于SPI进行系统短信发送的方法及装置,所述方法包括构建标准短信接口并实例化;基于标准短信接口进行处理以实现不同应用业务场景的需求;通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;构建新的服务加载器并根据服务加载器构建加载类处理对象;遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。本发明通过SPI机制在短消息方面的应用,不需要开发人员改动源码,实现了扩展;在符合开闭原则的前提下,只需要添加或修改配置,就可以灵活的实现扩展或改变策略,来达到系统灵活应用,将开发成本缩减到最小,加快系统的上线的效率,提高了时效性。The present invention provides a method and device for sending system short messages based on SPI. The method includes constructing a standard short message interface and instantiating it; processing based on the standard short message interface to realize the requirements of different application business scenarios; judging its belonging through the application business scene The scope of the business domain and the corresponding interface call template, and determine the service that needs to be called to trigger the call to the SMS device and build a standard call interface; build a new service loader and build a loading class processing object according to the service loader; traverse the configuration file All services in the configuration file will be instantiated by reflective loading of classes. The present invention uses the SPI mechanism in the application of short messages, and does not require developers to change the source code to achieve expansion; under the premise of conforming to the principle of opening and closing, only need to add or modify the configuration, it can flexibly realize the expansion or change the strategy. Achieve flexible application of the system, minimize development costs, speed up the efficiency of system launch, and improve timeliness.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明基于SPI进行系统短信发送的方法的步骤示意图;Fig. 1 is the step schematic diagram of the method that the present invention carries out system note transmission based on SPI;
图2为本发明构建标准短信接口的流程示意图;Fig. 2 is the schematic flow chart that the present invention builds standard short message interface;
图3为本发明基于SPI进行系统短信发送的装置的结构示意图。FIG. 3 is a schematic structural diagram of a device for sending system short messages based on SPI according to the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将对本发明的技术方案进行详细的描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所得到的所有其它实施方式,都属于本发明所保护的范围。In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other implementations obtained by persons of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
SPI是为了被扩展的接口寻找服务的具体实现的技术,SPI由调用方来制定接口规范,目前短消息调用在真正的调用的时侯,根据业务场景选择自己需要的外部服务商的短信实现,真正实现了调用和实现的解耦,要能在系统运行中,动态的更换不同的运营商的服务,也可以在新国家业务的开展过程中,动态的加载新的服务。SPI is a technology to find the specific implementation of the service for the extended interface. SPI is the caller to formulate the interface specification. At present, when the short message call is actually called, it chooses the short message implementation of the external service provider it needs according to the business scenario. It truly realizes the decoupling of invocation and implementation. It is necessary to be able to dynamically replace the services of different operators during system operation, and to dynamically load new services during the development of services in new countries.
现有的业务实现,需要先拿到运营商的接口服务,然后开发调用调试,每新增一个运营商,新增一个国家都需要同样的开发周期和流程,极大的重复劳动和低效率。To realize the existing business, it is necessary to first obtain the interface service of the operator, and then develop, call and debug. Every time a new operator or country is added, the same development cycle and process are required, which causes great duplication of labor and low efficiency.
本申请提供的技术方案,在业务调用固化的场景前提下,海外系统可以在零调整的情况下,新的方案根据业务发展,不同国家,不同时区,不同运营商的消息服务进行后加载,从而满足新业务的发展和实现。The technical solution provided by this application, under the premise that the business call is solidified, the overseas system can be post-loaded according to the business development, different countries, different time zones, and different operators’ message services under the condition of zero adjustment, so that Meet the development and realization of new business.
下面结合附图介绍本申请实施例中提供的一个具体的基于SPI进行系统短信发送的方法。A specific method for sending system short messages based on SPI provided in the embodiment of the present application is described below with reference to the accompanying drawings.
如图1所示,本申请实施例中提供的基于SPI进行系统短信发送的方法,包括:As shown in Figure 1, the method for sending system short messages based on SPI provided in the embodiment of the present application includes:
S101,构建标准短信接口并实例化;S101, constructing a standard SMS interface and instantiating it;
S102,基于所述标准短信接口进行处理以实现不同应用业务场景的需求;S102, perform processing based on the standard short message interface to meet requirements of different application business scenarios;
所述构建标准短信接口并实例化,包括:Described construction standard SMS interface and instantiation, including:
通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;Judge the scope of the business domain to which it belongs and the corresponding interface call template by applying the business scenario, and judge the service that needs to be called to trigger the call of the SMS device and build a standard call interface;
构建新的服务加载器并根据所述服务加载器构建加载类处理对象;Constructing a new service loader and constructing a loading class processing object according to the service loader;
遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。Traversing all the services in the configuration file and instantiating the classes in the configuration file through reflective loading.
基于SPI进行系统短信发送的方法的工作原理为:参见图2,首先通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;构建新的服务加载器并根据所述服务加载器构建加载类处理对象;遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。在构建标准短信接口后,进行处理以实现不同应用业务场景的需求。The working principle of the method for sending system text messages based on SPI is as follows: see Figure 2, first judge the scope of the business domain to which it belongs and the corresponding interface calling template through the application business scenario, and judge the service that needs to be called to trigger the calling of the text message device and build Standard call interface; build a new service loader and build a loading class processing object according to the service loader; traverse all services in the configuration file and instantiate the class reflection loading in the configuration file. After constructing the standard SMS interface, process it to meet the requirements of different application business scenarios.
本申请提供利用SPI技术进行系统短信发送的方法,能够解决动态的加载服务扩展,而不需要整体牵动整个业务系统进行调整,利用小手术完成大问题,最终缩短了开发的周期,提高了系统的响应能力。This application provides a method for sending system short messages using SPI technology, which can solve dynamic loading and service expansion without involving the entire business system for adjustment, and use small operations to complete major problems, ultimately shortening the development cycle and improving the system. responsiveness.
优选的,所述应用业务场景包括:Preferably, the application business scenarios include:
取件短信、催提短信以及用户登录验证码。Retrieval text messages, reminder text messages and user login verification codes.
优选的,所述根据所述服务加载器构建加载类处理对象,包括:Preferably, said constructing a loading class processing object according to said service loader includes:
通过传入的所述服务加载器,利用java提供的内部API构建新的后加载的迭代器。Through the incoming service loader, use the internal API provided by java to construct a new post-loaded iterator.
优选的,所述将配置文件中类反射加载进行实例化,包括:Preferably, the class reflection loading in the configuration file is instantiated, including:
将配置文件中所有配置类信息,通过反射加载实例化并且加载到缓存中去。Instantiate and load all configuration class information in the configuration file into the cache through reflective loading.
优选的,所述基于所述标准短信接口进行处理以实现不同应用业务场景的需求,包括:Preferably, the processing based on the standard SMS interface to meet the requirements of different application business scenarios includes:
根据不同国家的运营商提供的服务器地址、报文的格式以及对应的协议将寻消息内容进行推送。Push the message content according to the server address, message format and corresponding protocol provided by operators in different countries.
本实施例中,通过在业务场景取件短信、催提短信、用户登录验证码等场景,可以判断当前的业务场景所属的业务域的范围,以及对应的接口调用模板,可以判断出当前需要调用具体的服务。在应用植系统中触发调用短信的装置,使用通用的接口,供不同国家、不同时区、不同语言、不同的业务场景进行使用。本实施案例中,预先定义好标准的短信的调用方接口,将装配的控制权移到了应用系统程序的外部,只需要根据约定在META/services/目录下创建一个以服务接口命名的文件,该文件里就是实现服务接口的具体服务实现对象,外部程序装配该模块的时侯,就能通过配置文件找到具体的实现类名,并装载实例化,完成模块的注入。然后定义一个SMSSendInterface接口,ServiceLoader<SMSSendInterface>smsSendInterface构建新的ServiceLoader对象。通过传入当前的类加载器,利用java提供的内部API来实现, Thread.currentThread().getContextClassLoader(),构建一个新的后加载的迭代器。需要说明的是上面的后加载的迭代器,是一个内部类,通过扫描(特别注意是所有引用的jar包)META-INF/Service目录的配置文件中所有的Service的名字。在这个过程中,系统将配置文件中所有配置类信息,通过反射加载,实例化并且加载到缓存中去。In this embodiment, by picking up text messages, reminding text messages, user login verification codes and other scenarios in business scenarios, it is possible to determine the scope of the business domain to which the current business scenario belongs, and the corresponding interface call template, to determine the current need to call specific services. The device for triggering and invoking SMS in the application system uses a common interface for use in different countries, different time zones, different languages, and different business scenarios. In this implementation case, the caller interface of the standard SMS is pre-defined, and the control of assembly is moved to the outside of the application system program. It is only necessary to create a file named after the service interface in the META/services/ directory according to the agreement. In the file is the specific service implementation object that implements the service interface. When the external program assembles the module, it can find the specific implementation class name through the configuration file, load and instantiate it, and complete the injection of the module. Then define an SMSSendInterface interface, ServiceLoader<SMSSendInterface>smsSendInterface constructs a new ServiceLoader object. By passing in the current class loader and using the internal API provided by java, Thread.currentThread().getContextClassLoader(), constructs a new post-loaded iterator. It should be noted that the post-loaded iterator above is an internal class that scans (specially pay attention to all referenced jar packages) the names of all services in the configuration file of the META-INF/Service directory. In this process, the system loads, instantiates and loads all configuration class information in the configuration file into the cache through reflection.
基于所述标准短信接口进行处理以实现不同应用业务场景的需求,只需要在该目录下对全限定名SMSSendInterface.java文件,该文件中指定全路径的 namespace名字,比如com.xxx.xxx.VnSMSSendImpl, com.xxx.xxx.TlSMSSendImpl,com.xxx.xxx.CbSMSSendImpl。以下举例说明。Based on the standard SMS interface to process to achieve the needs of different application business scenarios, only need to fully name the SMSSendInterface.java file in this directory, specify the namespace name of the full path in this file, such as com.xxx.xxx.VnSMSSendImpl , com.xxx.xxx.TlSMSSendImpl, com.xxx.xxx.CbSMSSendImpl. The following example illustrates.
VnSMSSendImpl:VnSMSSendImpl:
VnSMSSendImpl是越南短消息发送的具体实现,我们根据越南运营商提供的服务的地址,报文的格式,对应的协议将短消息内容推送即可。VnSMSSendImpl is the specific implementation of sending short messages in Vietnam. We can push the content of short messages according to the service address provided by Vietnamese operators, the format of the message, and the corresponding protocol.
TlSMSSendImpl:TlSMSSendImpl:
TlSMSSendImpl是泰国短消息发送的具体实现,我们根据泰国运营商提供的服务的地址,报文的格式,对应的协议将短消息内容推送即可。TlSMSSendImpl is the specific implementation of sending short messages in Thailand. We can push the content of short messages according to the address of the service provided by the operator in Thailand, the format of the message, and the corresponding protocol.
CbSMSSendImpl:CbSMSSendImpl:
CbSMSSendImpl是柬埔寨短消息发送的具体实现,我们根据柬埔寨运营商提供的服务的地址,报文的格式,对应的协议将短消息内容推送即可。CbSMSSendImpl is the specific implementation of sending short messages in Cambodia. We can push the content of short messages according to the service address provided by Cambodian operators, the format of the message, and the corresponding protocol.
如图3所示,本申请实施例提供一种基于SPI进行系统短信发送的装置,包括:As shown in Figure 3, the embodiment of the present application provides a device for sending system short messages based on SPI, including:
构建模块301,用于构建标准短信接口并实例化;
处理模块302,用于基于所述标准短信接口进行处理以实现不同应用业务场景的需求;A
所述构建模块,包括:The building blocks include:
判断单元,用于通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;The judging unit is used to judge the scope of the business domain to which it belongs and the corresponding interface calling template through the application business scenario, and judge the service that needs to be called to trigger calling the short message device and construct a standard calling interface;
构建单元,用于构建新的服务加载器并根据所述服务加载器构建加载类处理对象;A construction unit for constructing a new service loader and constructing a loading class processing object according to the service loader;
加载单元,用于遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。The loading unit is used to traverse all the services in the configuration file and instantiate the classes in the configuration file by reflective loading.
本申请实施例提供一种基于SPI进行系统短信发送的装置的工作原理为,判断单元通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;构建单元构建新的服务加载器并根据所述服务加载器构建加载类处理对象;加载单元遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化,构建标准短信接口并实例化;处理模块基于所述标准短信接口进行处理以实现不同应用业务场景的需求。The embodiment of the present application provides a device for sending system short messages based on SPI. The working principle is that the judging unit judges the scope of the business domain it belongs to and the corresponding interface calling template through the application business scene, and judges the service that needs to be called to trigger the call SMS device and build a standard call interface; the construction unit builds a new service loader and builds a loading class processing object according to the service loader; the loading unit traverses all services in the configuration file and instantiates the class reflection loading in the configuration file Construct and instantiate a standard short message interface; the processing module performs processing based on the standard short message interface to meet the requirements of different application business scenarios.
本申请实施例提供一种计算机设备,包括处理器,以及与处理器连接的存储器;An embodiment of the present application provides a computer device, including a processor, and a memory connected to the processor;
存储器用于存储计算机程序,计算机程序用于执行上述任一实施例提供的基于SPI进行系统短信发送的方法;The memory is used to store a computer program, and the computer program is used to perform the method for sending a system short message based on SPI provided by any of the above-mentioned embodiments;
处理器用于调用并执行存储器中的计算机程序。The processor is used to call and execute the computer program in the memory.
综上所述,本发明提供一种基于SPI进行系统短信发送的方法及装置,所述方法包括构建标准短信接口并实例化;基于标准短信接口进行处理以实现不同应用业务场景的需求;通过应用业务场景判断其所属的业务域的范围以及对应的接口调用模板,并判断需要调用的服务以触发调用短信装置并构建标准的调用接口;构建新的服务加载器并根据服务加载器构建加载类处理对象;遍历配置文件中的所有服务并将配置文件中类反射加载进行实例化。本发明通过SPI 机制在短消息方面的应用,不需要开发人员改动源码,实现了扩展;在符合开闭原则的前提下,只需要添加或修改配置,就可以灵活的实现扩展或改变策略,来达到系统灵活应用,将开发成本缩减到最小,加快系统的上线的效率,提高了时效性。In summary, the present invention provides a method and device for sending system short messages based on SPI. The method includes constructing a standard short message interface and instantiating it; processing based on the standard short message interface to realize the needs of different application business scenarios; The business scenario judges the scope of the business domain it belongs to and the corresponding interface call template, and judges the service that needs to be called to trigger the call to the SMS device and build a standard call interface; build a new service loader and build a loading class according to the service loader. Object; traverse all the services in the configuration file and instantiate the classes in the configuration file by reflective loading. Through the application of the SPI mechanism in the short message, the present invention realizes the extension without requiring developers to change the source code; on the premise of conforming to the principle of opening and closing, only need to add or modify the configuration, it can flexibly realize the expansion or change the strategy, to Achieve flexible application of the system, minimize development costs, speed up the efficiency of system launch, and improve timeliness.
可以理解的是,上述提供的方法实施例与上述的装置实施例对应,相应的具体内容可以相互参考,在此不再赘述。It can be understood that the method embodiments provided above correspond to the above device embodiments, and the corresponding specific contents can be referred to each other, and will not be repeated here.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application 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 and optical storage, etc.) having computer-usable program code embodied therein.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/ 或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令方法的制造品,该指令方法实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising the instructions, the instructions The method implements the function specified in the procedure or procedures of the flowchart and/or the block or blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.
Claims (3)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111101924.7A CN113795001B (en) | 2021-09-18 | 2021-09-18 | Method and device for sending system short messages based on SPI |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111101924.7A CN113795001B (en) | 2021-09-18 | 2021-09-18 | Method and device for sending system short messages based on SPI |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113795001A CN113795001A (en) | 2021-12-14 |
CN113795001B true CN113795001B (en) | 2023-01-31 |
Family
ID=79184138
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111101924.7A Active CN113795001B (en) | 2021-09-18 | 2021-09-18 | Method and device for sending system short messages based on SPI |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113795001B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115297446B (en) * | 2022-06-28 | 2023-06-27 | 上海淇玥信息技术有限公司 | Short message service access optimization processing method, system and computer equipment |
CN115604002A (en) * | 2022-10-13 | 2023-01-13 | 卡斯柯信号有限公司(Cn) | Train communication front-end processor interface extension method and system based on proxy server |
CN118469623A (en) * | 2024-04-28 | 2024-08-09 | 广州市玄瞳科技有限公司 | Data interaction method and device for fast-food-eliminating multi-service scene |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103686723A (en) * | 2012-09-19 | 2014-03-26 | 镇江诺尼基智能技术有限公司 | System and method for processing complex SMS (short message service) message of mobile customer hotline SMS messaging service hall |
CN103607702B (en) * | 2013-11-15 | 2018-09-07 | 上海大汉三通通信股份有限公司 | A kind of method and system communicated between different platform in short message service |
CN105843654A (en) * | 2016-04-14 | 2016-08-10 | 广州市久邦数码科技有限公司 | Method and system for implementing dynamic loading of advertisement SDK (software development kit) |
CN111258772B (en) * | 2018-12-01 | 2022-08-09 | 阿里巴巴集团控股有限公司 | Service calling information processing method, device and system |
CN109710428B (en) * | 2018-12-27 | 2021-07-13 | 杭州数梦工场科技有限公司 | Dynamic calling method and device for implementation class |
CN110955543A (en) * | 2019-12-12 | 2020-04-03 | 浙江大搜车软件技术有限公司 | Service processing method, device, equipment and computer readable storage medium |
CN113115241B (en) * | 2021-04-07 | 2022-11-15 | 青岛容商天下网络有限公司 | Industrial Internet system based on industrial brain |
-
2021
- 2021-09-18 CN CN202111101924.7A patent/CN113795001B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN113795001A (en) | 2021-12-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113795001B (en) | Method and device for sending system short messages based on SPI | |
CA2600503C (en) | Method and system for executing a container-managed application on a processing device | |
CN104317591B (en) | A kind of web interface frame system and web method for processing business based on OSGi | |
US9569292B2 (en) | Remotable contracts for the web | |
WO2006068943A2 (en) | Method and apparatus for supporting soft real-time behavior | |
CN112035090B (en) | Intelligent contract intelligent management system and method based on containerization technology | |
EP3582125A1 (en) | System and methods with reduced complexity in the integration of exposed information models with applications | |
CN106775781B (en) | Method and device for reducing application installation packages and electronic equipment | |
CN112835615B (en) | Plug-in processing method and device for software development kit and electronic equipment | |
CN117632372A (en) | Helm-based continuous deployment management method | |
CN108345458A (en) | A kind of call method and system of static compilation language and script | |
CN103678100B (en) | The application automated testing method of terminal and system thereof | |
CN113542390A (en) | A method and system for IoT device management using memory data model | |
CN112905273A (en) | Service calling method and device | |
CN113312031B (en) | Naming service interface of software communication system structure | |
CN111338614A (en) | Application program interface development method, device, device and storage medium | |
CN113918242B (en) | Application programming interface calling method, device, electronic device and storage medium | |
CN114297062A (en) | Service testing method and device, electronic equipment and storage medium | |
CN114422637B (en) | Media request processing method and cross-platform engine system | |
CN100490471C (en) | Apparatus for communicating between cellular modem software and application engine software of a communications device | |
CN114880020A (en) | Software development kit management method, related device and computer program product | |
CN113961376A (en) | Message middleware switching method and device | |
CN114816358A (en) | A service platform development method and device | |
CN113312390A (en) | Service data calling method and device, storage medium and electronic equipment | |
Dietrich et al. | Formal methods for communication services: meeting the industry expectations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |