我有队列中的订户客户端,我可以对收到的消息进行确认。
当我执行NACK时,消息不会重新传递到队列中。
帮助我重新发送邮件到队列。
import ssl
from stompest.config import StompConfig
from stompest.sync import Stomp
from stompest.protocol import StompSpec
user = "admin"
password = "admin"
host = "localhost"
port = 61613
config = StompConfig('tcp://%s:%d' % (host, int(port)), login=user, passcode=password, version=StompSpec.VERSION_1_2,
sslContext=sslContext)
client = Stomp(config)
client.connect(host=host)
client.subscribe(destination=destination, headers={StompSpec.ACK_HEADER: StompSpec.ACK_CLIENT_INDIVIDUAL, "id":"1"})
while True:
data = client.receiveFrame()
client.nack(data)
activepq.xml中的经纪人和重新交付配置
<broker schedulerSupport="true">
<plugins>
<redeliveryPlugin fallbackToDeadLetter="true"
sendToDlqIfMaxRetriesExceeded="true">
<redeliveryPolicyMap>
<redeliveryPolicyMap>
<redeliveryPolicyEntries>
<!-- a destination specific policy -->
<redeliveryPolicy queue="SpecialQueue"
maximumRedeliveries="4"
redeliveryDelay="10000"/>
</redeliveryPolicyEntries>
<defaultEntry>
<!-- the fallback policy for all other destinations -->
<redeliveryPolicy maximumRedeliveries="4"
initialRedeliveryDelay="5000"
redeliveryDelay="10000"/>
</defaultEntry>
</redeliveryPolicyMap>
</redeliveryPolicyMap>
</redeliveryPlugin>
</plugins>
</broker>