Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0688D200C62 for ; Wed, 26 Apr 2017 12:57:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 04E79160BB4; Wed, 26 Apr 2017 10:57:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 385F4160BC6 for ; Wed, 26 Apr 2017 12:57:00 +0200 (CEST) Received: (qmail 10411 invoked by uid 500); 26 Apr 2017 10:56:59 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 9315 invoked by uid 99); 26 Apr 2017 10:56:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2017 10:56:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3C297DFBB7; Wed, 26 Apr 2017 10:56:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jross@apache.org To: commits@qpid.apache.org Date: Wed, 26 Apr 2017 10:57:13 -0000 Message-Id: <686d49236f5546b48d9640530447a834@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/40] qpid-site git commit: QPID-7756: Simplify release scripts and add some for new components archived-at: Wed, 26 Apr 2017 10:57:03 -0000 http://git-wip-us.apache.org/repos/asf/qpid-site/blob/32dce6b5/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp.html b/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp.html deleted file mode 100755 index 89d5822..0000000 --- a/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - -Qpid Proton C++ API: /tmp/jross/transom/qpid-proton-0.13.0/examples/cpp/broker.hpp File Reference - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
Qpid Proton C++ API -  0.13.0 -
-
- - - - - - -
-
-
- - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
broker.hpp File Reference
-
-
- -

Common code used by different broker examples. -More...

-
#include <proton/connection.hpp>
-#include <proton/delivery.hpp>
-#include <proton/messaging_handler.hpp>
-#include <proton/message.hpp>
-#include <proton/sasl.hpp>
-#include <proton/sender.hpp>
-#include <proton/tracker.hpp>
-#include <proton/transport.hpp>
-#include <proton/sender_options.hpp>
-#include <proton/receiver_options.hpp>
-#include <proton/source_options.hpp>
-#include <proton/target_options.hpp>
-#include <iostream>
-#include <deque>
-#include <map>
-#include <list>
-#include <sstream>
-#include <proton/config.hpp>
-
-

Go to the source code of this file.

- - - - - - - - - - - -

-Classes

class  queue
 A simple implementation of a queue. More...
 
class  queues
 A collection of queues and queue factory, used by a broker. More...
 
class  broker_handler
 Common handler logic for brokers. More...
 
-

Detailed Description

-

Common code used by different broker examples.

-

The examples add functionality as needed, this helps to make it easier to see the important differences between the examples.

-
-
- - - - http://git-wip-us.apache.org/repos/asf/qpid-site/blob/32dce6b5/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp_source.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp_source.html b/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp_source.html deleted file mode 100755 index 48a2e99..0000000 --- a/content/releases/qpid-proton-0.13.0/proton/cpp/api/broker_8hpp_source.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - -Qpid Proton C++ API: /tmp/jross/transom/qpid-proton-0.13.0/examples/cpp/broker.hpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
Qpid Proton C++ API -  0.13.0 -
-
- - - - - - -
-
-
- - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
broker.hpp
-
-
-Go to the documentation of this file.
1 #ifndef BROKER_HPP
-
2 #define BROKER_HPP
-
3 
-
4 /*
-
5  * Licensed to the Apache Software Foundation (ASF) under one
-
6  * or more contributor license agreements. See the NOTICE file
-
7  * distributed with this work for additional information
-
8  * regarding copyright ownership. The ASF licenses this file
-
9  * to you under the Apache License, Version 2.0 (the
-
10  * "License"); you may not use this file except in compliance
-
11  * with the License. You may obtain a copy of the License at
-
12  *
-
13  * http://www.apache.org/licenses/LICENSE-2.0
-
14  *
-
15  * Unless required by applicable law or agreed to in writing,
-
16  * software distributed under the License is distributed on an
-
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-
18  * KIND, either express or implied. See the License for the
-
19  * specific language governing permissions and limitations
-
20  * under the License.
-
21  */
-
22 
-
29 
-
30 #include <proton/connection.hpp>
-
31 #include <proton/delivery.hpp>
-
32 #include <proton/messaging_handler.hpp>
-
33 #include <proton/message.hpp>
-
34 #include <proton/sasl.hpp>
-
35 #include <proton/sender.hpp>
-
36 #include <proton/tracker.hpp>
-
37 #include <proton/transport.hpp>
-
38 #include <proton/sender_options.hpp>
-
39 #include <proton/receiver_options.hpp>
-
40 #include <proton/source_options.hpp>
-
41 #include <proton/target_options.hpp>
-
42 
-
43 #include <iostream>
-
44 #include <deque>
-
45 #include <map>
-
46 #include <list>
-
47 #include <sstream>
-
48 
-
50 class queue {
-
51  public:
-
52  queue(const std::string &name, bool dynamic = false) : name_(name), dynamic_(dynamic) {}
-
53 
-
54  std::string name() const { return name_; }
-
55 
-
56  void subscribe(proton::sender s) {
-
57  consumers_.push_back(s);
-
58  }
-
59 
-
60  // Return true if queue can be deleted.
-
61  bool unsubscribe(proton::sender s) {
-
62  consumers_.remove(s);
-
63  return (consumers_.size() == 0 && (dynamic_ || messages_.size() == 0));
-
64  }
-
65 
-
66  void publish(const proton::message &m) {
-
67  messages_.push_back(m);
-
68  dispatch(0);
-
69  }
-
70 
-
71  void dispatch(proton::sender *s) {
-
72  while (deliver_to(s)) {}
-
73  }
-
74 
-
75  bool deliver_to(proton::sender *s) {
-
76  // Deliver to single sender if supplied, else all consumers
-
77  int count = s ? 1 : consumers_.size();
-
78 
-
79  if (!count) return false;
-
80 
-
81  bool result = false;
-
82  sender_list::iterator it = consumers_.begin();
-
83 
-
84  if (!s && count) {
-
85  s = &*it;
-
86  }
-
87 
-
88  while (messages_.size()) {
-
89  if (s->credit()) {
-
90  const proton::message& m = messages_.front();
-
91 
-
92  s->send(m);
-
93  messages_.pop_front();
-
94  result = true;
-
95  }
-
96 
-
97  if (--count) {
-
98  it++;
-
99  } else {
-
100  return result;
-
101  }
-
102  }
-
103 
-
104  return false;
-
105  }
-
106 
-
107  private:
-
108  typedef std::deque<proton::message> message_queue;
-
109  typedef std::list<proton::sender> sender_list;
-
110 
-
111  std::string name_;
-
112  bool dynamic_;
-
113  message_queue messages_;
-
114  sender_list consumers_;
-
115 };
-
116 
-
118 class queues {
-
119  public:
-
120  queues() : next_id_(0) {}
-
121  virtual ~queues() {}
-
122 
-
123  // Get or create a queue.
-
124  virtual queue &get(const std::string &address = std::string()) {
-
125  if (address.empty()) {
-
126  throw std::runtime_error("empty queue name");
-
127  }
-
128 
-
129  queue*& q = queues_[address];
-
130 
-
131  if (!q) q = new queue(address);
-
132 
-
133  return *q;
-
134  }
-
135 
-
136  // Create a dynamic queue with a unique name.
-
137  virtual queue &dynamic() {
-
138  std::ostringstream os;
-
139  os << "q" << next_id_++;
-
140  queue *q = queues_[os.str()] = new queue(os.str(), true);
-
141 
-
142  return *q;
-
143  }
-
144 
-
145  // Delete the named queue
-
146  virtual void erase(std::string &name) {
-
147  delete queues_[name];
-
148  queues_.erase(name);
-
149  }
-
150 
-
151  protected:
-
152  typedef std::map<std::string, queue *> queue_map;
-
153  queue_map queues_;
-
154  uint64_t next_id_; // Use to generate unique queue IDs.
-
155 };
-
156 
-
157 #include <proton/config.hpp>
-
158 
- -
161  public:
-
162  broker_handler(queues& qs) : queues_(qs) {}
-
163 
- -
165  std::cout << "Connection from user: " << t.sasl().user() << " (mechanism: " << t.sasl().mech() << ")" << std::endl;
-
166  }
-
167 
-
168  void on_sender_open(proton::sender &sender) OVERRIDE {
-
169  proton::source src(sender.source());
-
170  queue &q = src.dynamic() ?
-
171  queues_.dynamic() : queues_.get(src.address());
-
172  sender.open(proton::sender_options().source(proton::source_options().address(q.name())));
-
173  q.subscribe(sender);
-
174  std::cout << "broker outgoing link from " << q.name() << std::endl;
-
175  }
-
176 
-
177  void on_receiver_open(proton::receiver &receiver) OVERRIDE {
-
178  std::string address = receiver.target().address();
-
179  if (!address.empty()) {
-
180  receiver.open(proton::receiver_options().target(proton::target_options().address(address)));
-
181  std::cout << "broker incoming link to " << address << std::endl;
-
182  }
-
183  }
-
184 
-
185  void unsubscribe(proton::sender lnk) {
-
186  std::string address = lnk.source().address();
-
187 
-
188  if (queues_.get(address).unsubscribe(lnk)) {
-
189  queues_.erase(address);
-
190  }
-
191  }
-
192 
-
193  void on_sender_close(proton::sender &sender) OVERRIDE {
-
194  unsubscribe(sender);
-
195  }
-
196 
- -
198  remove_stale_consumers(c);
-
199  }
-
200 
- -
202  remove_stale_consumers(t.connection());
-
203  }
-
204 
- -
206  std::cout << "broker client disconnect: " << t.error().what() << std::endl;
-
207  }
-
208 
-
209  void on_error(const proton::error_condition &c) OVERRIDE {
-
210  std::cerr << "broker error: " << c.what() << std::endl;
-
211  }
-
212 
-
213  void remove_stale_consumers(proton::connection connection) {
-
214  proton::sender_range sr = connection.senders();
-
215  for (proton::sender_iterator i = sr.begin(); i != sr.end(); ++i) {
-
216  if (i->active())
-
217  unsubscribe(*i);
-
218  }
-
219  }
-
220 
-
221  void on_sendable(proton::sender &s) OVERRIDE {
-
222  std::string address = s.source().address();
-
223 
-
224  queues_.get(address).dispatch(&s);
-
225  }
-
226 
- -
228  std::string address = d.receiver().target().address();
-
229  queues_.get(address).publish(m);
-
230  }
-
231 
-
232  protected:
-
233  queues& queues_;
-
234 };
-
235 
-
236 #endif // BROKER_HPP
- -
An AMQP message.
Definition: message.hpp:49
-
A channel for sending messages.
Definition: sender.hpp:40
-
Options for creating a sender.
Definition: sender_options.hpp:64
-
Common handler logic for brokers.
Definition: broker.hpp:160
-
void on_receiver_open(proton::receiver &receiver) OVERRIDE
The remote peer opened the link.
Definition: broker.hpp:177
-
void on_sendable(proton::sender &s) OVERRIDE
A message can be sent.
Definition: broker.hpp:221
-
void on_error(const proton::error_condition &c) OVERRIDE
Fallback error handling.
Definition: broker.hpp:209
-
A connection to a remote AMQP peer.
Definition: connection.hpp:48
-
A point of origin for messages.
Definition: source.hpp:41
-
void on_sender_close(proton::sender &sender) OVERRIDE
The remote peer closed the link.
Definition: broker.hpp:193
-
void on_connection_close(proton::connection &c) OVERRIDE
The remote peer closed the connection.
Definition: broker.hpp:197
-
A simple implementation of a queue.
Definition: broker.hpp:50
-
A received message.
Definition: delivery.hpp:40
-
class source source() const
Get the source node.
-
void on_sender_open(proton::sender &sender) OVERRIDE
The remote peer opened the link.
Definition: broker.hpp:168
-
A collection of queues and queue factory, used by a broker.
Definition: broker.hpp:118
-
void on_message(proton::delivery &d, proton::message &m) OVERRIDE
A message is received.
Definition: broker.hpp:227
-
Options for creating a source node for a sender or receiver.
Definition: source_options.hpp:45
-
void on_transport_error(proton::transport &t) OVERRIDE
The underlying network transport has closed with an error condition.
Definition: broker.hpp:205
-
sender_range senders() const
Return all senders on this connection.
-
Options for creating a receiver.
Definition: receiver_options.hpp:62
-
void on_transport_close(proton::transport &t) OVERRIDE
The underlying network transport has closed.
Definition: broker.hpp:201
-
A channel for receiving messages.
Definition: receiver.hpp:39
-
std::string address() const
The address of the source.
-
void on_transport_open(proton::transport &t) OVERRIDE
The underlying network transport is open.
Definition: broker.hpp:164
-
A handler for Proton messaging events.
Definition: messaging_handler.hpp:75
-
A network channel supporting an AMQP connection.
Definition: transport.hpp:42
-
Options for creating a target node for a sender or receiver.
Definition: target_options.hpp:47
-
tracker send(const message &m)
Send a message on the sender.
-
Describes an endpoint error state.
Definition: error_condition.hpp:37
-
-
- - - - http://git-wip-us.apache.org/repos/asf/qpid-site/blob/32dce6b5/content/releases/qpid-proton-0.13.0/proton/cpp/api/classbroker__handler-members.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/api/classbroker__handler-members.html b/content/releases/qpid-proton-0.13.0/proton/cpp/api/classbroker__handler-members.html deleted file mode 100755 index 4adab28..0000000 --- a/content/releases/qpid-proton-0.13.0/proton/cpp/api/classbroker__handler-members.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - -Qpid Proton C++ API: Member List - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
Qpid Proton C++ API -  0.13.0 -
-
- - - - - - -
-
-
- - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
broker_handler Member List
-
-
- -

This is the complete list of members for broker_handler, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
broker_handler(queues &qs) (defined in broker_handler)broker_handlerinline
messaging_handler() (defined in messaging_handler)messaging_handler
on_connection_close(proton::connection &c) OVERRIDEbroker_handlerinlinevirtual
on_connection_error(connection &c)messaging_handlervirtual
on_connection_open(connection &c)messaging_handlervirtual
on_container_start(container &c)messaging_handlervirtual
on_delivery_settle(delivery &d)messaging_handlervirtual
on_error(const proton::error_condition &c) OVERRIDEbroker_handlerinlinevirtual
on_message(proton::delivery &d, proton::message &m) OVERRIDEbroker_handlerinlinevirtual
on_receiver_close(receiver &l)messaging_handlervirtual
on_receiver_drain_finish(receiver &r)messaging_handlervirtual
on_receiver_error(receiver &l)messaging_handlervirtual
on_receiver_open(proton::receiver &receiver) OVERRIDEbroker_handlerinlinevirtual
on_sendable(proton::sender &s) OVERRIDEbroker_handlerinlinevirtual
on_sender_close(proton::sender &sender) OVERRIDEbroker_handlerinlinevirtual
on_sender_drain_start(sender &s)messaging_handlervirtual
on_sender_error(sender &l)messaging_handlervirtual
on_sender_open(proton::sender &sender) OVERRIDEbroker_handlerinlinevirtual
on_session_close(session &s)messaging_handlervirtual
on_session_error(session &s)messaging_handlervirtual
on_session_open(session &s)messaging_handlervirtual
on_tracker_accept(tracker &d)messaging_handlervirtual
on_tracker_reject(tracker &d)messaging_handlervirtual
on_tracker_release(tracker &d)messaging_handlervirtual
on_tracker_settle(tracker &d)messaging_handlervirtual
on_transport_close(proton::transport &t) OVERRIDEbroker_handlerinlinevirtual
on_transport_error(proton::transport &t) OVERRIDEbroker_handlerinlinevirtual
on_transport_open(proton::transport &t) OVERRIDEbroker_handlerinlinevirtual
remove_stale_consumers(proton::connection connection) (defined in broker_handler)broker_handlerinline
unsubscribe(proton::sender lnk) (defined in broker_handler)broker_handlerinline
~messaging_handler() (defined in messaging_handler)messaging_handlervirtual
-
- - - - --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org