Bug 449003
Summary: | request-response example: support clean shutdown of server apps | ||
---|---|---|---|
Product: | Red Hat Enterprise MRG | Reporter: | Alan Conway <aconway> |
Component: | Messaging_Programming_Reference | Assignee: | Alison Young <alyoung> |
Status: | CLOSED WONTFIX | QA Contact: | ecs-bugs |
Severity: | low | Docs Contact: | |
Priority: | medium | ||
Version: | beta | CC: | gsim, iboverma, lbrindle |
Target Milestone: | 2.0 | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2010-12-06 11:28:47 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Alan Conway
2008-05-29 20:35:29 UTC
I believe the actual cause is that the python 'server' application is killed by the verify script before it has time to send the acknowledgement. The temporary solution in the verification is to add a short sleep before the kill (which I have done). The better solution however is to alter the examples to support a clean shutdown of the server at the clients request. From aconway: "The server fix: if (request.body == "shutdown") break; Client fix: after sending requests: session.message_transfer(destination="amq.direct", message=Message(message_properties, delivery_properties, "shutdown")) Test harness fix: take out the kill, wait for the server to exit like other examples. And equivalent changes for C++ & Java examples. " We've added and removed code to shut down this way at least once, and I think perhaps more than once. I don't see that code in the example now. Have we changed our minds? Jonathan void Listener::received(Message& request) { Message response; // Get routing key for response from the request's replyTo property string routingKey; if (request.getMessageProperties().hasReplyTo()) { routingKey = request.getMessageProperties().getReplyTo().getRoutingKey(); } else { std::cout << "Error: " << "No routing key for request (" << request.getData() << ")" << std::endl; return; } std::cout << "Request: " << request.getData() << " (" <<routingKey << ")" << std::endl; // Transform message content to upper case std::string s = request.getData(); std::transform (s.begin(), s.end(), s.begin(), toupper); response.setData(s); // Send it back to the user response.getDeliveryProperties().setRoutingKey(routingKey); // Asynchronous transfer sends messages as quickly as // possible without waiting for confirmation. asyncSession.messageTransfer(arg::content=response, arg::destination="amq.direct"); } Hi, Can the code please be reviewed for this bug and advice returned regarding whether this example is still relevant for the Programming in Apache Qpid book? Thanks, Alison Hi, Can I please get confirmation that this bug is still relevant and required for inclusion in MRG 2.0 and also that the code used is still correct. Thanks, Alison Not a doc bug really anyway; more an enhancement to the automated testing of the old examples. This is no longer needed as these are being removed from trunk. |