Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of method that realizes multi-protocols message unified interface and relevant apparatus, system to realize not needing peripheral system to carry out the purpose of interface processing unified the picking out of message of the peripheral system of variety of protocol.
The invention provides a kind of method that realizes multi-protocols message unified interface, the method comprises:
Receive the access message of the first peripheral system;
According to the agreement of described access message, select first transformation rule corresponding with the agreement of access message;
Utilize described the first transformation rule, will access message conversion is platform message;
Described platform message is sent to the second peripheral system corresponding to platform message.
Alternatively, the access message of described reception the first peripheral system specifically receives by the input of monitoring each access interface.
Alternatively, also verified the IP address of the first peripheral system before the access message that receives the first peripheral system, if checking is passed through, foundation is connected with described the first peripheral system;
Set up with being connected of the first peripheral system after, also send heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the first peripheral system is connected;
Perhaps,
Set up with being connected of the first peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
Alternatively, the access message of described reception the first peripheral system is specially the access message that receives the first peripheral system at default fixedly access interface;
Described agreement according to access message, select first transformation rule corresponding with the agreement of access message to be specially:
According to the access interface that receives access message, obtain the incoming end slogan;
The first transformation rule corresponding to inquiry incoming end slogan.
Alternatively, described agreement according to access message, select first transformation rule corresponding with the agreement of access message to be specially:
Extract the key feature of described access message;
Inquire about the first transformation rule corresponding to described key feature.
Alternatively, described the first transformation rule is specially:
The first tabulation that the included field name of the agreement of access message is arranged according to predefined procedure;
The second tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The included field name of the agreement of described access message is specifically tabulated according to the first tabulation and second with the corresponding relation between the included field name of platform message, and order is corresponding one by one for listed field name.
Alternatively, described first transformation rule that utilizes, will access message conversion is that platform message is specially:
According to the order of the listed field name of the first tabulation, from access message, extract the field value of respective field title;
From the second tabulation, order is extracted field name;
With described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the second tab sequential, form platform message.
The present invention also provides a kind of device of realizing multi-protocols message unified interface, comprising:
The first receiving element: the access message that is used for receiving the first peripheral system;
The first converting unit: be used for the agreement according to described access message, select first transformation rule corresponding with the agreement of access message, utilize described the first transformation rule, will access message conversion is platform message.
The first transmitting element: be used for described platform message is sent to the second peripheral system corresponding to platform message.
The present invention provides again a kind of method that realizes multi-protocols message unified interface, comprising:
Receiving platform message;
Second peripheral system corresponding according to described platform message selected second transformation rule corresponding with the agreement of described the second peripheral system;
Utilize described the second transformation rule, with described platform message conversion for picking out message;
The described message that picks out is sent to the second peripheral system corresponding to described platform message.
Alternatively, described receiving platform message is specially and receives the platform message come from the stiff end slogan, wherein, and IP address port, corresponding second transformation rule of corresponding one or more known the second peripheral systems of stiff end slogan;
Described second peripheral system corresponding according to platform message, select second transformation rule corresponding with the agreement of described the second peripheral system to be specially:
According to the platform message that receives, obtain to send the port numbers of this platform message;
Inquire about the second transformation rule corresponding to this port numbers.
Alternatively, described second peripheral system corresponding according to platform message, select second transformation rule corresponding with the agreement of described the second peripheral system to be specially:
Extract the key feature of described platform message;
Inquire about the second transformation rule corresponding to described key feature.
Alternatively, described the second transformation rule is specially:
The 3rd tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The 4th tabulation that the included field name of the agreement of the second peripheral system is arranged according to predefined procedure;
The included field name of the agreement of platform message is specifically tabulated according to the 3rd tabulation and the 4th with the corresponding relation between the included field name of the agreement of the second peripheral system, and order is corresponding one by one for listed field name.
Alternatively, utilize described the second transformation rule, the platform message conversion be specially for picking out message:
According to the order of the listed field name of the 3rd tabulation, from platform message, extract the field value of respective field title;
From the 4th tabulation, order is extracted field name;
With described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the 4th tab sequential, form and pick out message.
Alternatively, the described message that will pick out is sent to the second peripheral system corresponding to platform message and is specially:
Corresponding the second peripheral system IP address, the port of port numbers of this platform message sent in inquiry;
According to the second peripheral system IP address, port, the described message that picks out is sent to described the second peripheral system.
Alternatively, the described message that will pick out is sent to the second peripheral system corresponding to platform message and is specially:
Inquire about corresponding the second peripheral system IP address, the port of key feature of this platform message;
According to the second peripheral system IP address, port, the described message that picks out is sent to described the second peripheral system.
Alternatively, the described message that picks out is sent to described the second peripheral system before also according to the second peripheral system IP address, port, foundation is connected with the second peripheral system;
Set up with being connected of the second peripheral system after, also send heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the second peripheral system is connected;
Perhaps,
Set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
The present invention provides a kind of device of realizing multi-protocols message unified interface again, comprising:
The second receiving element: be used for receiving platform message;
The second converting unit: be used for second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system, utilize described the second transformation rule, with described platform message conversion for picking out message;
Second picks out the unit: be used for the described message that picks out is sent to the second peripheral system corresponding to described platform message.
The present invention further provides a kind of method that realizes multi-protocols message unified interface, comprising:
Receive the access message of the first peripheral system;
According to the agreement of described access message, select first transformation rule corresponding with the agreement of access message;
Utilize described the first transformation rule, will access message conversion is platform message;
Second peripheral system corresponding according to described platform message selected second transformation rule corresponding with the agreement of described the second peripheral system;
Utilize described the second transformation rule, with described platform message conversion for picking out message;
The described message that picks out is sent to the second peripheral system corresponding to described platform message.
Alternatively, the access message of described reception the first peripheral system specifically receives by the input of monitoring each access interface.
Alternatively, before receiving the access message of the first peripheral system, also set up and being connected of described the first peripheral system;
Set up with being connected of the first peripheral system after, also send heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the first peripheral system is connected;
Perhaps,
Set up with being connected of the first peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
The described message that will pick out is sent to and also sets up before described the second peripheral system and being connected of the second peripheral system;
Set up with being connected of the second peripheral system after, also send heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the second peripheral system is connected;
Perhaps,
Set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
Alternatively, described first transformation rule that utilizes will access message conversion and be after the platform message, and second peripheral system corresponding according to described platform message selected also to comprise before second transformation rule corresponding with the agreement of described the second peripheral system:
Described platform message is sent to the ESB service bus;
When the message queue that listens to the ESB service bus has described platform message, obtain described platform message from message queue.
The present invention further provides a kind of system that realizes multi-protocols message unified interface, comprising:
Access module: be used for receiving the access message of the first peripheral system, according to the agreement of described access message, select first transformation rule corresponding with the agreement of access message, utilize described the first transformation rule, will access message conversion is platform message;
Pick out module: be used for second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system, utilize described the second transformation rule, described platform message conversion for picking out message, is sent to the second peripheral system corresponding to described platform message with the described message that picks out.
Alternatively, described access module: also be used for monitoring the input of each access interface, when the input that listens to access interface, receive access message.
Alternatively, described access module: also be used for before the access message that receives the first peripheral system, setting up and being connected of described the first peripheral system, set up with being connected of the first peripheral system after, also send heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnect and being connected of described the first peripheral system; Perhaps, set up with being connected of the first peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
The described module that picks out: also be used for setting up before being sent to described the second peripheral system and being connected of the second peripheral system will picking out message, set up with being connected of the second peripheral system after, also send heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnect and being connected of described the second peripheral system; Perhaps, set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
Alternatively, this system also comprises: ESB service bus module: specifically be used for the described platform message of buffer memory;
Access module: also be used for described platform message is sent to ESB service bus module;
Pick out module: also be used for when the message queue that listens to the ESB service bus has described platform message, obtain described platform message from the message queue of ESB service bus module.
As seen the present invention has following beneficial effect:
Because the present invention is after the access message that receives the first peripheral system, according to the agreement that adopts of access message, select first transformation rule corresponding with the agreement of access message, can realize the corresponding a kind of transformation rule of a kind of messaging protocol, various transformation rules are integrated, the transformation rule corresponding to agreement of recycling access message, to access message conversion is platform message, so that the present invention is when message accesses, the message of the peripheral system that receives can be the message of the agreement of peripheral system own, so that the first peripheral system is when initiating a message, needn't be concerned about the conversion between the different agreement of message, the direct access message of the agreement of transmission own has alleviated the access interface processing load of the first peripheral system;
In addition, the present invention is after receiving platform message, second peripheral system corresponding according to platform message, select second transformation rule corresponding with the agreement of the second peripheral system, the recycling transformation rule, with the platform message conversion for picking out message, therefore can be with the corresponding a kind of transformation rule of a kind of messaging protocol when the invention process, various transformation rules are integrated, make the second peripheral system when receipt message, needn't be concerned about the conversion between the different agreement of message, can directly receive the message that picks out of agreement own, what alleviated peripheral system picks out the interface processing load;
And, respectively the access that accesses message and platform message is picked out method in conjunction with above-mentioned two kinds, so that peripheral system all needn't be concerned about the conversion between the agreement of message in message access with when picking out, can directly send or pick out the message of agreement own, alleviate the interface processing load of peripheral system.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments the embodiment of the invention is described in further detail.
Referring to Fig. 1, be a kind of method flow diagram of realizing multi-protocols message unified interface provided by the invention, as shown in the figure, the method comprises:
The access message of S101, reception the first peripheral system;
S102, according to the agreement of described access message, select first transformation rule corresponding with the agreement that accesses message;
S103, utilize described the first transformation rule, will access message conversion is platform message;
S104, described platform message is sent to the second peripheral system corresponding to platform message.
Need to prove, described platform message can be the message of the self-defining protocol format of unified interface realized of the present invention in the present invention, also can be the message of the protocol format of ESB service bus oneself requirement, specifically can be according to the form of implementing requirement definition platform message.
As seen, in the method, because after the access message that receives the first peripheral system, according to the agreement that adopts of access message, select first transformation rule corresponding with the agreement of access message, can realize the corresponding a kind of transformation rule of a kind of messaging protocol, various transformation rules are integrated, the transformation rule corresponding to agreement of recycling access message, to access message conversion is platform message, so that the present invention is when message accesses, the message of the peripheral system that receives can be the message of the agreement of peripheral system own, so that the first peripheral system when initiating a message, needn't be concerned about the conversion between the different agreement of message, alleviated the interface processing load of the first peripheral system.
If the message of described access message for encrypting, after reading described access message, the method can also comprise: decipher described access message.
Before the access message that receives the first peripheral system, can also comprise: verify the IP address of the first peripheral system, if checking is passed through, foundation is connected with described the first peripheral system.
, verify the IP address of the first peripheral system can comprise not only whether the IP address of verifying the first peripheral system is effective here, can also comprise whether the IP address of verifying the first peripheral system has the authority access.
In order not cause the waste of connection resource, this embodiment can also comprise: set up with being connected of the first peripheral system after, also send heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnect and being connected of described the first peripheral system.
Perhaps,
Set up with being connected of the first peripheral system after, record each data transmission period of this connection;
Calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
In above embodiment, can be pre-created a plurality of connecting objects, when setting up with being connected of the first peripheral system, from a plurality of connecting objects that are pre-created, choose the connecting object realization of free time and being connected of the first peripheral system, and this connecting object state is set to busy, when disconnecting with being connected of the first peripheral system, the connecting object state that this disconnects is set to the free time.
Wherein, the described agreement according to access message of step S102 is selected first transformation rule corresponding with the agreement of access message, particularly, can comprise two embodiment:
In one embodiment, the access of the peripheral system of a corresponding a kind of agreement of access interface, particularly, in this embodiment, the access message of described reception the first peripheral system of step S101 is specially the access message that receives the first peripheral system at default fixedly access interface.
Correspondingly, in this embodiment, the described agreement according to access message of step S102, select first transformation rule corresponding with the agreement of access message specifically can may further comprise the steps:
According to the access message that receives, obtain the incoming end slogan;
The first transformation rule corresponding to inquiry incoming end slogan.
In another embodiment, the corresponding a kind of protocol type of the key feature that access message has, key feature can be the message body length of access message, it is corresponding first transformation rule of access message of certain-length message body, perhaps key feature also can be the keyword of access message, namely access corresponding first transformation rule of keyword of message, for example, keyword is the system coding field value of access message, corresponding first transformation rule of system coding field value, particularly, in this embodiment, step S102 specifically can may further comprise the steps:
Extract the key feature of described access message;
Inquire about the first transformation rule corresponding to described key feature.
Any execution mode can dispose in configuration information file more than concrete the employing, if the corresponding a kind of protocol type of the key feature that adopts the field of access message to have, the key feature of concrete extraction also can dispose in configuration information file.
Below, the first transformation rule is made an explanation, in a specific embodiment of the method, described the first transformation rule is specifically as follows:
The first tabulation that the included field name of the agreement of access message is arranged according to predefined procedure;
The second tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The included field name of the agreement of described access message is specifically tabulated according to the first tabulation and second with the corresponding relation between the included field name of platform message, and order is corresponding one by one for listed field name.
In the specific embodiment of this first transformation rule, described step S103, utilize described the first transformation rule, will access message conversion is platform message, specifically may further comprise the steps:
S103.1, according to the order of the listed field name of the first tabulation, from access message, extract the field value of respective field title;
S103.2, from the second tabulation, order is extracted field name;
S103.3, with described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the second tab sequential, form platform message.
Wherein, before the step S103, can also comprise: verify whether described access message format meets the described agreement of waiting to send out message, if meet, then checking is passed through, execution in step S103, otherwise, authentication failed, return the access message error, particularly, for example, whether described checking access message format meets the agreement of waiting to send out message, specifically can verify by following steps:
Calculate the message body length of described access message;
With the predefined message-length of the agreement of described message body length and described access message relatively, whether equate;
If equate, then execution in step S103 is passed through in checking;
If unequal, then checking is not passed through, and returns the access message error.
Wherein, step S103.1 can also verify that whether this field value meets this field attribute requirement, does not return translation exception message if meet after extracting the field value of respective field title.
Wherein, step S104, described platform message is sent to the second peripheral system corresponding to platform message, when implementation of the present invention, numerous embodiments can be arranged, for example:
Can send to first the ESB service bus and carry out buffer memory, by the ESB service bus described platform message is sent to the second corresponding peripheral system;
Can also from configuration information, take out the second peripheral system IP address port information corresponding to this service coding according to the coding of the service in the platform message, directly platform message be sent to the second peripheral system;
Perhaps, can also be according to the system coding in the platform message, the second peripheral system IP address port information corresponding to extraction system coding directly sends to the second peripheral system with platform message from configuration information.
Form in platform message described in the above embodiment is specifically as follows the XML structure, for example, structure message as shown in Figure 2, according to the characteristics of XML structure, this platform message can also be converted to the java object, uses the List array representation, the title of XML node wherein, such as SvcCode, be a field name of platform messaging protocol, the value of this field is the service coding of platform.
Referring to Fig. 3, be a kind of composition diagram of realizing the device of multi-protocols message unified interface that the present invention also provides, as shown in the figure, this device comprises:
The first receiving element 301: the access message that is used for receiving the first peripheral system;
The first converting unit 302: be used for the agreement according to described access message, select first transformation rule corresponding with the agreement of access message, utilize described the first transformation rule, will access message conversion is platform message.
The first transmitting element 303: be used for described platform message is sent to the second peripheral system corresponding to platform message.
Referring to Fig. 4, be a kind of flow chart of realizing the method for multi-protocols message unified interface that the present invention provides again, as shown in the figure, the method comprises:
S401, receiving platform message;
S402, second peripheral system corresponding according to described platform message are selected second transformation rule corresponding with the agreement of described the second peripheral system;
S403, utilize described the second transformation rule, with described platform message conversion for picking out message;
S404, the described message that picks out is sent to the second peripheral system corresponding to described platform message.
As seen, in the method, after receiving platform message, second peripheral system corresponding according to platform message, select second transformation rule corresponding with the agreement of the second peripheral system, the recycling transformation rule, with the platform message conversion for picking out message, therefore can be with the corresponding a kind of transformation rule of a kind of messaging protocol when the invention process, various transformation rules are integrated, make the second peripheral system when receipt message, needn't be concerned about the conversion between the different agreement of message, can directly receive the message that picks out of agreement own, alleviate the interface processing load of peripheral system.
Wherein, the message of receiving platform described in the step S401 when implementation of the present invention, can receive from the executive agent of any transmission platform message, for example: can receive from the ESB service bus, can also receive from the device of the unified access of above-mentioned a kind of multi-protocols message, etc.
Wherein, second peripheral system corresponding according to platform message described in the step S402 selected second transformation rule corresponding with the agreement of described the second peripheral system, particularly, can comprise following two embodiment:
Among the embodiment, step S401 receiving platform message is specially and receives the platform message that comes from the stiff end slogan, wherein, IP address port, corresponding second transformation rule of corresponding one or more known the second peripheral systems of stiff end slogan, this second transformation rule is specifically formulated according to the agreement of described one or more known the second peripheral systems, here, described the second known peripheral system specifically can be the second peripheral system of known IP address, port and agreement;
Correspondingly, in this embodiment, step S402 specifically may further comprise the steps:
According to the platform message that receives, obtain to send the port numbers of this platform message;
Inquire about the second transformation rule corresponding to this port numbers.
Among another embodiment, the corresponding a kind of protocol type of the key feature that platform message has, for example, key feature is the message body length of platform message, it is the IP address port of corresponding one or more known the second peripheral systems of the platform message of certain-length message body, corresponding second transformation rule, perhaps key feature is the keyword of platform message, be a kind of corresponding one or more the second peripheral system IP address ports of keyword of platform message, corresponding second transformation rule, described keyword, for example, can get SvcCode, namely serve the field value of code field.
Correspondingly, in this embodiment, step S402 specifically may further comprise the steps:
Extract the key feature of described platform message;
Inquire about the second transformation rule corresponding to described key feature.
Any execution mode can dispose in configuration information file more than concrete the employing, if the corresponding a kind of protocol type of the key feature that adopts the field of access message to have, the key feature of concrete extraction also can dispose in configuration information file.
Below, the second transformation rule is made an explanation, in a specific embodiment of the method, described the second transformation rule is specifically as follows:
The 3rd tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The 4th tabulation that the included field name of the agreement of the second peripheral system is arranged according to predefined procedure;
The included field name of the agreement of platform message is specifically tabulated according to the 3rd tabulation and the 4th with the corresponding relation between the included field name of the agreement of the second peripheral system, and order is corresponding one by one for listed field name.
In the specific embodiment of this second transformation rule, described step S403, utilize described the second transformation rule, the platform message conversion for picking out message, specifically be may further comprise the steps:
S403.1, according to the order of the listed field name of the 3rd tabulation, from platform message, extract the field value of respective field title;
S403.2, from the 4th tabulation, order is extracted field name;
S403.3, with described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the 4th tab sequential, form and pick out message.
Wherein, step S403.1 can also verify that whether this field value meets this field attribute requirement, does not return translation exception message if meet after extracting the field value of respective field title.
For the safety of guarantee information, after step S403, before the step S404, can also comprise: with the described message encryption that picks out.
Wherein, step S404, the described message that picks out is sent to the second peripheral system corresponding to described platform message, according to two embodiment of above step S402, correspondingly, two kinds of implementations can be arranged also:
A kind of mode is specially:
Corresponding the second peripheral system IP address, the port of port numbers of this platform message sent in S404.1a, inquiry;
S404.2a, according to the second peripheral system IP address, port, the described message that picks out is sent to described the second peripheral system.
Another kind of execution mode is specially:
S404.1b, inquire about corresponding the second peripheral system IP address, the port of key feature of this platform message;
S404.2b, according to the second peripheral system IP address, port, the described message that picks out is sent to described the second peripheral system.
Wherein, the described message that picks out is sent to before described the second peripheral system, the method also comprises: according to the second peripheral system IP address, port, set up and being connected of the second peripheral system.
In order not cause the waste of connection resource, set up with being connected of the second peripheral system after, also sends heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the second peripheral system is connected;
Perhaps,
Set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate last data data transmission period and the time interval of current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
In above embodiment, can be pre-created a plurality of connecting objects, when setting up with being connected of the second peripheral system, from a plurality of connecting objects that are pre-created, choose the connecting object realization of free time and being connected of the second peripheral system, and this connecting object state is set to busy, when disconnecting with being connected of the second peripheral system, the connecting object state that this disconnects is set to the free time.
The form of platform message described in this embodiment is specifically as follows such as the XML structure among the above-mentioned embodiment, does not repeat them here.
Referring to Fig. 5, be a kind of installation composition figure that realizes multi-protocols message unified interface that the present invention provides again, as shown in the figure, this device comprises:
The second receiving element 501: be used for receiving platform message;
The second converting unit 502: be used for second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system, utilize described the second transformation rule, with described platform message conversion for picking out message;
Second picks out unit 503: be used for the described message that picks out is sent to the second peripheral system corresponding to described platform message.
Referring to Fig. 6, a kind of method flow diagram of realizing multi-protocols message unified interface for the present invention further provides comprises:
The access message of S601, reception the first peripheral system;
S602, according to the agreement of described access message, select first transformation rule corresponding with the agreement that accesses message;
S603, utilize described the first transformation rule, will access message conversion is platform message;
S604, second peripheral system corresponding according to described platform message are selected second transformation rule corresponding with the agreement of described the second peripheral system;
S605, utilize described the second transformation rule, with described platform message conversion for picking out message;
S606, the described message that picks out is sent to the second peripheral system corresponding to described platform message.
As seen, in the method, after the access message that receives the first peripheral system, according to the agreement that adopts of access message, select first transformation rule corresponding with the agreement of access message, the recycling transformation rule, to access message conversion is platform message, second peripheral system corresponding according to platform message again, select second transformation rule corresponding with the agreement of the second peripheral system, utilize transformation rule with the platform message conversion for picking out message, therefore can be with the corresponding a kind of transformation rule of a kind of messaging protocol, various transformation rules are integrated, and peripheral system needn't be concerned about the conversion between the agreement of message, can directly send or pick out the message of agreement own, alleviate the interface processing load of peripheral system.
Wherein, the access message of step S601, reception the first peripheral system specifically can receive by the input of monitoring each access interface, and wherein, each access interface of monitoring specifically can be monitored according to listening port default in the configuration information file.
If the message of described access message for encrypting, after reading described access message, the method can also comprise: decipher described access message.
Before the access message that receives the first peripheral system, can also comprise: verify the IP address of the first peripheral system, if checking is passed through, foundation is connected with described the first peripheral system.
, verify the IP address of the first peripheral system can comprise not only whether the IP address of verifying the first peripheral system is effective here, can also comprise whether the IP address of verifying the first peripheral system has the authority access.
In order not cause the waste of connection resource, this embodiment set up with being connected of the first peripheral system after, also sends heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the first peripheral system is connected;
Perhaps,
Set up with being connected of the first peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
Wherein, step S602, according to the agreement of described access message selects first transformation rule corresponding with the agreement of access message, and particularly, the agreement of described access message definite can have two kinds of execution modes:
A kind of mode: the access of the peripheral system of a corresponding a kind of agreement of access interface, particularly, in this embodiment, the access message of described reception the first peripheral system of step S601 is specially the access message that receives the first peripheral system at default fixedly access interface.
Correspondingly, in this embodiment, step S602 specifically can may further comprise the steps:
According to the access message that receives, obtain the incoming end slogan;
The first transformation rule corresponding to inquiry incoming end slogan.
Another kind of mode: the corresponding a kind of protocol type of the key feature that access message has, key feature can be the message body length of access message, it is corresponding first transformation rule of access message of certain-length message body, perhaps key feature also can be the keyword of access message, namely access corresponding first transformation rule of keyword of message, for example, keyword is the system coding field value of access message, corresponding first transformation rule of system coding field value, particularly, in this embodiment, step S602 specifically can may further comprise the steps:
Extract the key feature of described access message;
Inquire about the first transformation rule corresponding to described key feature.
Any execution mode can dispose in configuration information file more than concrete the employing, if the key feature that adopts the access message field to have is determined protocol type, the concrete key feature that adopts also can dispose in configuration information file.
Below, the first transformation rule is made an explanation, in a specific embodiment of the method, described the first transformation rule specifically comprises:
The first tabulation that the included field name of the agreement of access message is arranged according to predefined procedure;
The second tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The included field name of the agreement of described access message is specifically tabulated according to the first tabulation and second with the corresponding relation between the included field name of platform message, and order is corresponding one by one for listed field name.
In the specific embodiment of this first transformation rule, described step S603, utilize described the first transformation rule, will access message conversion is platform message, specifically may further comprise the steps:
S603.1, according to the order of the listed field name of the first tabulation, from access message, extract the field value of respective field title;
S603.2, from the second tabulation, order is extracted field name;
S603.3, with described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the second tab sequential, form platform message.
Wherein, before the step S603, can also comprise: verify whether described access message format meets the described agreement of waiting to send out message, if meet, then checking is passed through, execution in step S603, otherwise, authentication failed, return the access message error, particularly, for example, whether described checking access message format meets the agreement of waiting to send out message, specifically can verify by following steps:
Calculate the described message body length that counts message;
With the predefined message-length of the agreement of described message body length and described access message relatively, whether equate;
If equate, then execution in step S603 is passed through in checking;
If unequal, then checking is not passed through, and returns the access message error.
In another embodiment of the method, step S601 can also be disposed respectively to S606 two parts to S603 and step S604, between utilize the buffer memory of ESB service bus implementation platform message, particularly, wherein, step S603, utilize described the first transformation rule, will access message conversion and be after the platform message, before the step S604, also comprise:
Described platform message is sent flat to the ESB service bus;
When the message queue that listens to the ESB service bus has described platform message, obtain described platform message from message queue.
When implementation of the present invention, described platform message is sent to the ESB service bus, can comprise dual mode:
A kind of mode is that particular platform message is sent in the corresponding particular message formation, for example, be specifically as follows: judge the keyword that described platform message comprises, described platform message is sent to ESB service bus message queue corresponding to keyword, for example, get service coded word segment value as keyword, then this step is specially the service coding of judging described platform message, and described platform message is sent to receiving queue corresponding to service coding;
Another kind of mode is that platform message is on average sent in each message queue, and for example, be specifically as follows: the message queue according to a upper platform message sends to is sent to next message queue with described platform message.
Any execution mode can dispose in configuration information file more than concrete the employing.
Described platform message is sent to before the ESB service bus, can also comprises: set up and being connected of ESB service bus port, specifically can determine according to described platform message the ESB service bus port of correspondence; When the message queue that listens to the ESB service bus had described platform message, foundation was connected with described platform message place formation corresponding ports, obtains described platform message from message queue.
The function that itself provides according to the ESB service bus, a message queue can be corresponded to one or more the second peripheral systems, therefore, described step S604, second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system to be specifically as follows according to described platform message at the second peripheral system corresponding to the place of ESB service bus message queue, select second transformation rule corresponding with the agreement of described the second peripheral system.
Wherein, step S604, second peripheral system corresponding according to described platform message are selected second transformation rule corresponding with the agreement of described the second peripheral system, particularly, following examples can also be arranged:
In this embodiment, the corresponding a kind of protocol type of the key feature that platform message has, for example, key feature is the message body length of platform message, it is the IP address port of corresponding one or more known the second peripheral systems of the platform message of certain-length message body, corresponding second transformation rule, perhaps key feature is the keyword of platform message, be a kind of corresponding one or more the second peripheral system IP address ports of keyword of platform message, corresponding second transformation rule, described keyword, for example, desirable SvcCode namely serves the field value of code field, particularly, step S604 is specially:
Extract the key feature of described platform message;
Inquire about the second transformation rule corresponding to described key feature.
Step S604 is concrete to adopt above any execution mode to dispose in configuration information file, if the corresponding a kind of protocol type of the key feature that adopts the field of access message to have, the concrete key feature that extracts also can dispose in configuration information file.
Below, the second transformation rule is made an explanation, in a specific embodiment of the method, described the second transformation rule is specifically as follows:
The 3rd tabulation that the included field name of the agreement of platform message is arranged according to predefined procedure;
The 4th tabulation that the included field name of the agreement of the second peripheral system is arranged according to predefined procedure;
The included field name of the agreement of platform message is specifically tabulated according to the 3rd tabulation and the 4th with the corresponding relation between the included field name of the agreement of the second peripheral system, and order is corresponding one by one for listed field name.
In the specific embodiment of this second transformation rule, described step S605, utilize described the second transformation rule, described platform message conversion for picking out message, specifically be may further comprise the steps:
S605.1, according to the order of the listed field name of the 3rd tabulation, from platform message, extract the field value of respective field title;
S605.2, from the 4th tabulation, order is extracted field name;
S605..3, with described field value, according to the correspondence order, be kept at the field of the field name representative that extracts from the 4th tab sequential, form and pick out message.
For the safety of guarantee information, after step S605, before the step S606, can also comprise: described stating picked out message encryption.
Wherein, step S606, the described message that picks out is sent to the second peripheral system corresponding to described platform message, specifically may further comprise the steps:
S606.1, foundation are connected with the second peripheral system;
S606.2, the described message that picks out is sent to described the second peripheral system.
In order not cause the waste of connection resource, set up with being connected of the second peripheral system after, also sends heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnection and described the second peripheral system is connected;
Perhaps,
Set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
In above each embodiment, can be pre-created a plurality of connecting objects that are connected with the first peripheral system, perhaps create a plurality of connecting objects that are connected with the second peripheral system, when setting up with being connected of the first peripheral system or the second peripheral system, choosing idle connecting object from a plurality of connecting objects that are pre-created realizes connecting, and this connecting object state is set to busy, and when disconnecting, the connecting object state that this disconnects is set to the free time.
After step S606, the present invention also comprises: receive the return messages of the second peripheral system, the return messages of described the second peripheral system are sent to the first peripheral system.Particularly, the return messages of the second peripheral system can be added in the return results record, the return messages in the return results record are sent to first peripheral system to the method for step S606 with return messages according to step S601 of the present invention, not repeat them here.
Need to prove, more than the form of platform message described in each embodiment specifically can such as the XML structure among the above-mentioned embodiment, not repeat them here.
More than the described configuration information file of each embodiment specifically can adopt the document of XML structure, each node in the XML configuration information file represents configuration information corresponding to different disposal demand, the system manager can send modify instruction to configuration information file by the configuration management interface, can also comprise following configuration information file being made amendment to relevant configuration information by the configuration management interface.
In addition, when implementation of the present invention, can also monitor according to demand access message, platform message, pick out the abnormality of message when receiving, changing and sending, also can monitor running status and the message queue state of ESB service bus, when appearance is unusual, return unexpected message.
Referring to Fig. 7, a kind of system's composition diagram of realizing multi-protocols message unified interface for the present invention further provides comprises:
Access module 701: be used for receiving the access message of the first peripheral system, according to the agreement of described access message, select first transformation rule corresponding with the agreement of access message, utilize described the first transformation rule, will access message conversion is platform message;
Pick out module 702: be used for second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system, utilize described the second transformation rule, described platform message conversion for picking out message, is sent to the second peripheral system corresponding to described platform message with the described message that picks out.
Wherein, described access module 701 specifically can comprise:
The first receiving element 701A: the access message that is used for receiving the first peripheral system;
The first converting unit 701B: be used for the agreement according to described access message, select first transformation rule corresponding with the agreement of access message, utilize described the first transformation rule, will access message conversion is platform message.
Wherein, the described module 702 that picks out specifically can comprise:
The second converting unit 702A: be used for second peripheral system corresponding according to described platform message, select second transformation rule corresponding with the agreement of described the second peripheral system, utilize described the second transformation rule, with described platform message conversion for picking out message;
The second transmitting element 702B: be used for the described message that picks out is sent to the second peripheral system corresponding to described platform message.
In this embodiment, described access module 701: can also be used for monitoring the input of each access interface, when the input that listens to access interface, receive access message.
Described access module 701: can also be used for before the access message that receives the first peripheral system, setting up and being connected of described the first peripheral system, set up with being connected of the first peripheral system after, also send heartbeat message as the cycle to the first peripheral system take default time-out time, if do not receive the response message that returns, then disconnect and being connected of described the first peripheral system; Perhaps, set up with being connected of the first peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the first peripheral system.
The described module 702 that picks out: also be used for setting up before being sent to described the second peripheral system and being connected of the second peripheral system will picking out message, set up with being connected of the second peripheral system after, also send heartbeat message as the cycle to the second peripheral system take default time-out time, if do not receive the response message that returns, then disconnect and being connected of described the second peripheral system; Perhaps, set up with being connected of the second peripheral system after, also record each data transmission period of this connection, calculate the time interval of last data transmission period and current time, if the time interval surpasses default time-out time, then disconnect and being connected of the second peripheral system.
In another embodiment of this system, referring to Fig. 8, as shown in the figure, this system can also comprise ESB service bus module 803: be used for the described platform message of buffer memory;
Described access module 801: also be used for described platform message is sent to ESB service bus module 804;
The described module 802 that picks out: also be used for when the message queue that listens to the ESB service bus has described platform message, obtain described platform message from the message queue of ESB service bus module 803.
In addition, when implementation of the present invention, monitoring module 804 can also be set according to demand: concrete running status and the message queue state that is used for realization monitoring access module, picks out module, ESB service bus module, for example, monitoring access module and pick out module and whether have message access running status and message queue state unusual, that pick out unusual, translation exception, ESB service bus module whether unusual, when appearance is unusual, return unexpected message.
Need to prove, in this article, relational terms such as the first and second grades only is used for an entity or operation are made a distinction with another entity or operation, and not necessarily requires or hint and have the relation of any this reality or sequentially between these entities or the operation.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby not only comprise those key elements so that comprise process, method, article or the equipment of a series of key elements, but also comprise other key elements of clearly not listing, or also be included as the intrinsic key element of this process, method, article or equipment.Do not having in the situation of more restrictions, the key element that is limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
The above is preferred embodiment of the present invention only, is not for limiting protection scope of the present invention.All any modifications of doing within the spirit and principles in the present invention, be equal to replacement, improvement etc., all be included in protection scope of the present invention.