[Java] Finally got activemq

Source: Internet
Author: User
There are too few documents about this bird thing. errors are often reported during multithreading. errors may be reported during sending and receiving. No errors are reported on others' computers, and errors are prone to errors on my computer. In addition, a socketexception is thrown. The built-in thread pool only uses one activemqconnection. After a network error is detected, the connection is directly closed. The External Thread Pool packaging does not return the Connection check if it is closed, resulting in an error message interruption.

At the beginning, I added the close check myself. If an error occurs in the connection pool, the new connection will be returned. In this way, messagelistener also needs to be re-registered. The strange thing is that the exception processor registered in the session is actually effective ....

Later, the activemq Forum experts told me to use the automatic reconnection function: reliable: TCP: // host: Port as the URL, faint, it seems that the document is used to switch between multiple URLs.

Before the reply, I tried their 4.0m2 version. This version was greatly changed and encountered the following problems:
1. Spring support is gone. Start as follows:
Broker = org. activemq. Broker. brokerfactory. createbroker (New uri (
"Broker :( TCP: // localhost: 61616 )? Persistent = false "));
Broker. Start ();
2. For URL rule changes, see.
3. Different errors occur during multithreading. When the pooledsession is closed, the following error is reported: pool closed.
After checking, it is found that the pooledconnection. Close () method adds a sufficient way to disable the shared cache. It works normally after being commented out.
4. Automatic reconnection URL: failover: TCP: // host: Port

Version 4.0 is very fast after startup. It seems that there was no time for DNS resolution in the past.

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.