Development of Java wechat public platform (3) classification of received messages and creation of entities

The previous article said that the application server and Tencent server communicate through messages, and briefly introduced the message types of wechat post. Here we will establish a message entity for our later use!

(1) Message entity base class

(2) Ordinary message POJO entity

① Picture message

② Connection message

③ Geographic location message

④ Text message

⑤ Video / small screen message

⑥ Voice message

(3) Message classification processing

According to the above received message categories, we want to do different distribution processing. Here, we have established our own business distributors (eventdispatcher and msgdispatcher) to do ordinary message processing and event message processing respectively!

①MsgDispatcher. Java -- for business distribution and processing of ordinary messages

②EventDispatcher. Java -- business distribution and processing of event messages

At this time, we need to modify the post method in our message entry [wechatsecurity. Java]. The final results are as follows:

Finally, after running the project successfully, we can verify the correctness of our message classification by sending different types of messages, as shown in the following figure:

After creating so many files, let's finally look at the directory structure of our whole project:

The previous description is all about message reception, so the next article will talk about [classification of reply messages and creation of entities]. Thank you for reading. If you have any questions, you can leave a message and discuss them together!

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>