On 08/28/2013 11:50 PM, Rajesh Khan wrote:
Thanks that seems to do the trick. Any idea how I could do it programatically .
Attached is a simple example program. However I would advise investigating the autodelete issue a little more as I'm fairly confident it will do as expected if used in the right manner.
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ #include <qpid/messaging/Address.h> #include <qpid/messaging/Connection.h> #include <qpid/messaging/Message.h> #include <qpid/messaging/Receiver.h> #include <qpid/messaging/Sender.h> #include <qpid/messaging/Session.h> #include <qpid/types/Variant.h> #include <iostream> #include <sstream> using namespace qpid::messaging; using namespace qpid::types; using std::string; int main(int argc, char** argv) { Connection c(argc > 1 ? argv[1] : "localhost"); std::string queue(argc > 2 ? argv[2] : "my-queue"); try { c.open(); Session session = c.createSession(); Address responses("qmf.default.direct/my-name; {node: {type: topic}}"); Receiver r = session.createReceiver(responses); Sender s = session.createSender("qmf.default.direct/broker"); Message request; request.setReplyTo(responses); request.setContentType("amqp/map"); request.setProperty("x-amqp-0-10.app-id", "qmf2"); request.setProperty("qmf.opcode", "_method_request"); Variant::Map oid; std::stringstream name; name << "org.apache.qpid.broker:queue:" << queue; oid["_object_name"] = name.str(); Variant::Map content; content["_method_name"] = "purge"; content["_object_id"] = oid; Variant::Map arguments; arguments["request"] = 0;//set this to non-zero value to purge 'N' messages; 0 will purge all content["_arguments"] = arguments; encode(content, request); s.send(request); Message response = r.fetch(); Variant::Map contentIn; decode(response, contentIn); std::cout << response.getProperties() << ": " << contentIn << std::endl; session.acknowledge(); } catch(const std::exception& error) { std::cout << "ERROR: " << error.what() << std::endl; } c.close(); return 0; }
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org