An error occurred when activemq sent objectmessage.

Source: Internet
Author: User

Recently, we implemented distributed services for the company and sent messages through activemq. The messages are encapsulated into an object that implements serialization and sent by sending objectmessage, when receiving the message, it is found that only one message is sent, but it appears that the message has been received n times in the listener log. However, when reading the log of the sender, the message is actually sent only once, and anotherCodeIt is normal for the Branch to send instances of the same class. Then, let's take a look. In the wrong code branch, a variable in the class instance has no value, set the value. As follows:

 

 

// Branch with an error <br/> objactivemq O1 = new objactivem (); <br/> o1.n1 = "11111"; <br/> o1.n2 = "22222 "; <br/> // N3 is not set here </P> <p> // correct code branch <br/> objactivemq O2 = new objactivem (); <br/> o1.n1 = "AAAAA"; <br/> o1.n2 = "bbbbb"; <br/> // The N3 value is set here <br/> 01. n3 = "cccccc"; <br/>

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.