如果应用程序在处理过程中崩溃,MQ Light如何确保不会从队列中删除消息? [英] How does MQ Light assure that message is not removed from queue if app crashes during processing?

查看:112
本文介绍了如果应用程序在处理过程中崩溃,MQ Light如何确保不会从队列中删除消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

接收方的应用程序如何控制直到发送确认消息后消息才从队列中取出?例如,在一种情况下,接收方应用程序收到消息并崩溃后,从MQ角度来看消息将已经发送,但接收方应用程序尚未对其进行处理,从某种意义上讲,可能会丢失消息.有什么方法可以控制MQ何时从队列中删除该消息?

How can a receiving app control that the message is not taken out of the queue, till it sends an acknowledgement of the message? For example, a scenario where the receiving app gets the message and crashes post that, the message from MQ perspective would have been sent but the receiving app would not have yet processed it and in that sense there is a possibility of losing messages. Is there a way that we can control when MQ takes off that message from the queue?

从发送应用程序角度来看,类似的问题是,Bluemix上的MQ Light的SLA是多少,因此,如果MQLight出现故障,发送应用程序是否应该继续重新发送消息(持续多长时间).发送应用程序如何确保MQLight能够接收到它?

Similar question from sending app perspective, what is the SLA of MQ Light on Bluemix, so if MQLight goes down, should the sending application continue to resend (for how long) the message. How can sending app can be sure of MQLight receiving it?

推荐答案

应用程序可以在订阅调用中使用服务质量"属性来控制接收到的消息的传递保证.以下内容提供了详细的详细说明: https://developer.ibm. com/messaging/mq-light/docs/qos/

An app can use the 'Quality of service' property in a subscribe call to control the delivery guarantee for messages it receives. The following provides a good description of the details: https://developer.ibm.com/messaging/mq-light/docs/qos/

总而言之,如果您的应用需要使用消息确认,则应使用至少一次"的服务质量.如果您需要该应用来控制ack本身的发送,则可以通过使用autoConfirm属性来进一步控制.

In summary, if your app needs to use message acknowledgement then an 'Atleast once' quality of service should be used. Further control is then also possible by using the autoConfirm property if you need the app to control the sending of the ack itself.

同样,在发送消息时,应用程序可以将send调用的服务质量"属性设置为"Atleast一次",以从服务器接收明确的接受/拒绝确认.

Likewise, when sending messages, an application can set the 'Quality of service' property of the send call to 'Atleast once' to receive an explicit accepted/rejected confirmation from the server.

对于服务器一段时间不可用的情况,这意味着客户端将继续尝试重新连接并发送消息,直到(1)服务器再次可用并接受消息,(2)服务器再次可用并拒绝了消息,(3)客户端应用程序将客户端api更改为停止状态,或者(4)客户端应用程序已终止.在情况1-3中,客户将收到结果确认.

For a situation where the server is unavailable for a period of time, this would mean the client would continue to try to reconnect and send the message until either (1) the server is available again and accepted the message, (2) the server is available again and rejected the message, (3) the client api was changed to the stopped state by the client application or (4) the client application was terminated. In cases 1-3 the client will receive confirmation of the result.

这篇关于如果应用程序在处理过程中崩溃,MQ Light如何确保不会从队列中删除消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆