Reference blog post: http://www.cnblogs.com/SzeCheng/p/4792084.html
Reference blog post: http://activemq.apache.org/producer-flow-control.html
Explanation of terms:
P: Producer
C: Consumer
Server: P or ActiveMQ service
Client: ActiveMQ service or C
The sign that the client successfully receives a message is that the message has been signed. Successfully receiving a message generally includes the following three stages:
1. The client receives the message;
2. The client processes the message;
3. The message is signed.
session = connection.createSession(Boolean.false, Session.CLIENT_ACKNOWLEDGE);##第一个参数控制事务,第二个参数控制消息
In a Session without transactions, when and how a message is signed depends on the Session settings.
1. Session.AUTO_ACKNOWLEDGE
When the client returns successfully from receive or onMessage, Session automatically signs the client's receipt of this message.
2. Session.CLIENT_ACKNOWLEDGE
The client signs the message by calling the acknowledge method of the message.
message.acknowledge();
In a Session with a transaction, the signature automatically occurs when the transaction is submitted. If the transaction is rolled back, all received messages will be delivered again. In fact, Session.CLIENT_ACKNOWLEDGE here is of little use.
session = connection.createSession(Boolean.TRUE, Session.CLIENT_ACKNOWLEDGE);
session.commit();
Summary:
1. For the producer: the server is P and the client is ActiveMQ service. Session is set to AUTO_ACKNOWLEDGE and CLIENT_ACKNOWLEDGE. Relatively speaking, the difference is not very big. It depends on the situation.
2. For consumers: the server is ActiveMQ and the client is C. The Session is set to AUTO_ACKNOWLEDGE. When a message is received (receive or onMessage returns successfully), the consumption is successful, and the data is removed from the queue. We don't care whether the data is correctly processed into the results we want; when the Session is set to CLIENT_ACKNOWLEDGE, the acknowledge method must be manually called for successful consumption, and then the data is removed from the queue.
3. Which mode the Sessions of P and C are set to have no influence on each other.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
