Skip to content

Commit

Permalink
Merge pull request ceph#25866 from yuvalif/add_amqp_push_endpoint_new
Browse files Browse the repository at this point in the history
rgw/pubsub: add amqp push endpoint
  • Loading branch information
mattbenjamin authored Feb 20, 2019
2 parents f47ae25 + 6bc82a7 commit fcb8149
Show file tree
Hide file tree
Showing 36 changed files with 2,634 additions and 245 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ if(LINUX)
endif(LINUX)
CHECK_INCLUDE_FILES("valgrind/helgrind.h" HAVE_VALGRIND_HELGRIND_H)

CHECK_INCLUDE_FILE_CXX("amqp.h" HAVE_AMQP_H)
if(NOT HAVE_AMQP_H)
message(FATAL_ERROR "Can't find librabbitmq. Please run install-deps.sh")
endif()

include(CheckTypeSize)
set(CMAKE_EXTRA_INCLUDE_FILES "linux/types.h")
CHECK_TYPE_SIZE(__be16 __BE16)
Expand Down
1 change: 1 addition & 0 deletions ceph.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ BuildRequires: xfsprogs
BuildRequires: xfsprogs-devel
BuildRequires: xmlstarlet
BuildRequires: yasm
BuildRequires: librabbitmq-devel
%if 0%{with make_check}
BuildRequires: python%{_python_buildid}-bcrypt
BuildRequires: python%{_python_buildid}-coverage
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Build-Depends: bc,
libtool,
libudev-dev,
libxml2-dev,
librabbitmq-dev,
lsb-release,
parted,
pkg-config,
Expand Down
36 changes: 28 additions & 8 deletions doc/radosgw/pubsub-module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ PubSub Sync Module
This sync module provides a publish and subscribe mechanism for the object store modification
events. Events are published into defined topics. Topics can be subscribed to, and events
can be pulled from them. Events need to be acked. Also, events will expire and disappear
after a period of time. A basic push notification mechanism exists too, but it is not
reliable.
after a period of time. A push notification mechanism exists too, currently supporting HTTP and
AMQP0.9.1 endpoints.

A user can create different topics. A topic entity is defined by its user and its name. A
user can only manage its own topics, and can only subscribe to events published by buckets
Expand Down Expand Up @@ -57,7 +57,7 @@ The uid of the pubsub control user.

The prefix of the bucket name that will be created to store events for specific topic.

* ``endpoint`` (string)
* ``data_oid_prefix`` (string)

The oid prefix for the stored events.

Expand Down Expand Up @@ -99,10 +99,20 @@ the ``val`` specifies its new value. Nested values can be accessed using period.

A configuration field can be removed by using ``--tier-config-rm={key}``.

PubSub REST API
PubSub Performance Stats
-------------------------
- **pubsub_event_triggered**: running counter of events with at lease one pubsub topic associated with them
- **pubsub_event_lost**: running counter of events that had pubsub topics and subscriptions associated with them but that were not stored or pushed to any of the subscriptions
- **pubsub_store_ok**: running counter, for all subscriptions, of stored pubsub events
- **pubsub_store_fail**: running counter, for all subscriptions, of pubsub events that needed to be stored but failed
- **pubsub_push_ok**: running counter, for all subscriptions, of pubsub events successfully pushed to their endpoint
- **pubsub_push_fail**: running counter, for all subscriptions, of pubsub events failed to be pushed to their endpoint
- **pubsub_push_pending**: gauge value of pubsub events pushed to a endpoined but not acked or nacked yet

.. versionadded:: Luminous
Note that **pubsub_event_triggered** and **pubsub_event_lost** are incremented per event, while: **pubsub_store_ok**, **pubsub_store_fail**, **pubsub_push_ok**, **pubsub_push_fail**, are incremented per store/push action on each subscriptions.

PubSub REST API
-------------------------


Topics
Expand Down Expand Up @@ -189,13 +199,23 @@ Creates a new subscription.

::

PUT /subscriptions/<sub-name>?topic=<topic-name>[&push-endpoint=<endpoint>]
PUT /subscriptions/<sub-name>?topic=<topic-name>[&push-endpoint=<endpoint>[&amqp-exchange=<exchange>][&amqp-ack-level=<level>][&verify-ssl=true|false]]

Request Params:

- topic-name: name of topic
- push-endpoint: url of endpoint to send push notification to
- push-endpoint: URI of endpoint to send push notification to

- URI schema is: ``http|amqp://[<user>:<password>@]<fqdn>[:<port>][/<amqp-vhost>]``
- Same schema is used for HTTP and AMQP endpoints (except amqp-vhost which is specific to AMQP)
- Default values for HTTP: no user/password, port 80
- Default values for AMQP: user/password=guest/guest, port 5672, amqp-vhost is "/"

- verify-ssl: can be used with https endpoints (ignored for other endpoints), indicate whether the server certificate is validated or not ("true" by default)
- amqp-exchange: mandatory parameter for AMQP endpoint. The exchanges must exist and be able to route messages based on topics
- amqp-ack-level: 2 ack levels exist: "none" - message is considered "delivered" if sent to broker;
"broker" message is considered "delivered" if acked by broker.
No end2end acking is required, as messages may persist in the broker before delivered into their final destination

Get Subscription Info
````````````````````````````````````
Expand Down Expand Up @@ -247,4 +267,4 @@ Ack event so that it can be removed from the subscription history.
Request Params:
- event-id: id of event to be acked

.. _Multisite Configuration: ./multisite
.. _Multisite Configuration: ./multisite.rst
2 changes: 2 additions & 0 deletions install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ if [ x$(uname)x = xFreeBSDx ]; then
security/oath-toolkit \
sysutils/flock \
sysutils/fusefs-libs \
net/rabbitmq-c-devel \

# Now use pip to install some extra python modules
pip install pecan
Expand All @@ -239,6 +240,7 @@ else
echo "Using apt-get to install dependencies"
$SUDO apt-get install -y devscripts equivs
$SUDO apt-get install -y dpkg-dev
$SUDO apt-get install -y librabbitmq-dev
case "$VERSION" in
*Trusty*)
ensure_decent_gcc_on_ubuntu 7 trusty
Expand Down
22 changes: 13 additions & 9 deletions src/rgw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ add_executable(ceph_rgw_jsonparser
rgw_jsonparser.cc)
target_link_libraries(ceph_rgw_jsonparser
rgw_a
global)
global rabbitmq)

add_executable(ceph_rgw_multiparser
rgw_multiparser.cc)
target_link_libraries(ceph_rgw_multiparser
rgw_a
global)
global rabbitmq)

install(TARGETS
ceph_rgw_jsonparser
Expand Down Expand Up @@ -89,6 +89,8 @@ set(librgw_common_srcs
rgw_sync_module_es_rest.cc
rgw_sync_module_log.cc
rgw_sync_module_pubsub.cc
rgw_pubsub_push.cc
rgw_amqp.cc
rgw_sync_module_pubsub_rest.cc
rgw_sync_log_trim.cc
rgw_sync_trace.cc
Expand Down Expand Up @@ -132,7 +134,8 @@ set(librgw_common_srcs
rgw_rest_user_policy.cc
rgw_zone.cc
rgw_sts.cc
rgw_rest_sts.cc)
rgw_rest_sts.cc
rgw_perf_counters.cc)

add_library(rgw_common OBJECT ${librgw_common_srcs})

Expand Down Expand Up @@ -229,7 +232,7 @@ endif()

add_library(radosgw_a STATIC ${radosgw_srcs}
$<TARGET_OBJECTS:civetweb_common_objs>)
target_link_libraries(radosgw_a PRIVATE rgw_a)
target_link_libraries(radosgw_a PRIVATE rgw_a rabbitmq)
if(WITH_RADOSGW_BEAST_FRONTEND AND WITH_RADOSGW_BEAST_OPENSSL)
# used by rgw_asio_frontend.cc
target_link_libraries(radosgw_a PRIVATE OpenSSL::SSL)
Expand All @@ -255,7 +258,7 @@ target_link_libraries(radosgw-admin rgw_a librados
cls_log_client cls_timeindex_client
cls_version_client cls_user_client
global ${FCGI_LIBRARY} ${LIB_RESOLV}
${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${BLKID_LIBRARIES})
${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${BLKID_LIBRARIES} rabbitmq)
install(TARGETS radosgw-admin DESTINATION bin)

set(radosgw_es_srcs
Expand All @@ -266,7 +269,7 @@ target_link_libraries(radosgw-es rgw_a librados
cls_log_client cls_timeindex_client
cls_version_client cls_user_client
global ${FCGI_LIBRARY} ${LIB_RESOLV}
${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${BLKID_LIBRARIES})
${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${BLKID_LIBRARIES} rabbitmq)
install(TARGETS radosgw-es DESTINATION bin)

set(radosgw_token_srcs
Expand All @@ -284,7 +287,7 @@ target_link_libraries(radosgw-object-expirer rgw_a librados
cls_log_client cls_timeindex_client
cls_version_client cls_user_client
global ${FCGI_LIBRARY} ${LIB_RESOLV}
${CURL_LIBRARIES} ${EXPAT_LIBRARIES})
${CURL_LIBRARIES} ${EXPAT_LIBRARIES} rabbitmq)
install(TARGETS radosgw-object-expirer DESTINATION bin)

set(librgw_srcs
Expand All @@ -307,7 +310,8 @@ target_link_libraries(rgw
global
${LIB_RESOLV}
${CURL_LIBRARIES}
${EXPAT_LIBRARIES})
${EXPAT_LIBRARIES}
rabbitmq)
set_target_properties(rgw PROPERTIES OUTPUT_NAME rgw VERSION 2.0.0
SOVERSION 2)
install(TARGETS rgw DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down Expand Up @@ -337,7 +341,7 @@ target_link_libraries(rgw_admin_user PRIVATE
${EXPAT_LIBRARIES}
${OPENLDAP_LIBRARIES}
dmclock::dmclock
)
rabbitmq)
set_target_properties(rgw_admin_user PROPERTIES OUTPUT_NAME rgw_admin_user VERSION 1.0.0
SOVERSION 0)
install(TARGETS rgw_admin_user DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down
1 change: 1 addition & 0 deletions src/rgw/librgw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "rgw_lib_frontend.h"
#include "rgw_http_client.h"
#include "rgw_http_client_curl.h"
#include "rgw_perf_counters.h"

#include <errno.h>
#include <thread>
Expand Down
Loading

0 comments on commit fcb8149

Please sign in to comment.