java - How is it appropriate for multiple clients to operate MQ?
高洛峰
高洛峰 2017-05-17 09:57:34
0
1
545

I have 500 sub-applications deployed on 500 different servers, as well as a main application, and now there is an MQ. My main application will send messages to the sub-application. There are many functions on the sub-application, all of which require different messages.

Should I open a consumer in the sub-application, or should I open a consumer for each function of the sub-application?

My current plan is to open only one consumer for each sub-application, and then define the specific method of operation in the message sent. The format is as follows:

{
    "header": {
        "action": "scan_address"
    },
    "body": {
            "id": 1234,
            "name": "xxxxxx"
    }
}

When the sub-application gets the message, it decides which method to call based on the action. Then the body is the business data that needs to be processed.

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
左手右手慢动作

In your case, you are using MQ to make loosely coupled RPC calls. I don't know what your mq selection is. For example, Kafka, which I am familiar with, can use a topic, and then configure a single consumer group on a single machine, and then write messages according to RPC. Basically, it can be done without duplication or loss, and the upstream and downstream services are decoupled.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template