ActiveMQ队列消息时间戳
我正在使用ActiveMQ收集来自队列中不同生产商的消息。我注意到准备在经纪人队列中食用的消息中有一个名为“ Timestamp”的字段。这是制片人将消息发送给经纪人或经纪人收到消息的时间的时候?如果第一种情况是正确的,则假设生产商P1在时间T1上发送了消息,该消息是在时间T2到达经纪人的,而另一个生产商P2在TIME T3发送了一条消息,并且经纪人在TIME T4接收到T3> T1和T2> T4。这些Messagges会以哪个顺序排队和消耗?因此,我想知道队列中的消息的顺序是由经纪人接收到这些消息的顺序还是由其在生产者中的“发送”的时间戳给出。
深表歉意,如果我的问题有些困惑,
谢谢您的帮助!!!
我正在使用以下行发送messagges:
Destination destination = session.createQueue(jmsQueue);
producer = session.createProducer(destination);
TextMessage toSend = session.createTextMessage("some message");
producer.send(toSend);
/*
I'm not creating a session every time, I just want to show how I send messagges, with this example.
*/
这是Acitvemq的Web控制台的屏幕截图,该屏幕显示了我所指的“时间戳”属性。 图像
I'm using ActiveMQ to gather messages that comes from different producers in a queue. I noticed that messages ready to be consumed in the broker's queue have a field named "Timestamp". This is the time in which the message is sent by the producer to the broker or the time in which the broker receives the message? And if the first case is true, suppose the producer P1 sent the message at time t1 which arrives to the broker at time t2, while another producer P2 sent a message at time t3 and the broker receives it at time t4, with t3 > t1 and t2 > t4. In which order these messagges will be queued and so consumed ? So I want to know if the order of the messages in the queue is given by the order in which the broker receives these messages, or by the timestamp of their "send" in the producer.
Apologize if my question is a bit confused,
thank you for helping !!!
I'm sending messagges with these lines:
Destination destination = session.createQueue(jmsQueue);
producer = session.createProducer(destination);
TextMessage toSend = session.createTextMessage("some message");
producer.send(toSend);
/*
I'm not creating a session every time, I just want to show how I send messagges, with this example.
*/
This is a screenshoot of the AcitveMQ's web console, which shows the "Timestamp" property I'm referring to.
the image
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
队列中消息的顺序由经纪人接收到这些消息的顺序,而不是在发送这些消息时给出。消息上的时间戳属性不会以任何方式以队列确定消息的顺序。
当消息到达经纪人时,他们将放置在队列中。队列被订购,并具有首先出现(IE FIFO)语义。这些消息可能具有时间戳,也可能没有时间戳。有些协议和API使用时间戳,另一些则不使用时间戳。该消息是否具有时间戳与队列中消息的顺序根本没有关系。
如果消息具有时间戳,这些时间戳 May 反映了队列中消息的顺序。再说一次,他们可能不会。时间戳尚未确定队列中消息的顺序。
The order of the messages in the queue is given by the order in which the broker receives those messages, not by the time they are sent. The timestamp property on the message does not determine the order of the message in the queue in any way.
When messages arrive at the broker they are placed in the queue. The queue is ordered and has first-in-first-out (i.e. FIFO) semantics. The messages may have timestamps or they may not. Some protocols and APIs use timestamps, others don't. Whether or not the message has a timestamp has nothing fundamentally to do with the order of the messages in the queue.
If the messages have timestamps those timestamps may reflect the order of the messages in the queue. Then again, they might not. The timestamps make no determination about the order of the messages in the queue.