MySQL 8.0.40
Source Code Documentation
group_replication_message_service.h File Reference
#include <mysql/components/service.h>
#include <stddef.h>

Go to the source code of this file.

Classes

struct  s_mysql_group_replication_message_service_send
 A service that sends content agnostic messages from a member to the group. More...
 
struct  s_mysql_group_replication_message_service_recv
 A service that gets called whenever an agnostic message from the group replication stream is to be delivered by the group replication receiver thread. More...
 

Typedefs

typedef struct s_mysql_group_replication_message_service_send mysql_service_group_replication_message_service_send_t
 A service that sends content agnostic messages from a member to the group. More...
 
typedef struct s_mysql_group_replication_message_service_recv mysql_service_group_replication_message_service_recv_t
 A service that gets called whenever an agnostic message from the group replication stream is to be delivered by the group replication receiver thread. More...
 

Typedef Documentation

◆ mysql_service_group_replication_message_service_recv_t

A service that gets called whenever an agnostic message from the group replication stream is to be delivered by the group replication receiver thread.

The implementation MUST NOT block the caller.

This only works if the component is on a server with group replication running and the member state is ONLINE. If server isn't ONLINE message won't be notified about messages received.

DEFINE_BOOL_METHOD(recv, (const char *tag, const unsigned char *data,
size_t data_length)) {
// If tag is of interest do something with data
return false;
}
group_replication_message_service_recv)
bool register_listener() {
SERVICE_TYPE(registry) *plugin_registry = mysql_plugin_registry_acquire();
my_service<SERVICE_TYPE(registry_registration)> reg("registry_registration",
plugin_registry);
using group_replication_message_service_recv_t =
SERVICE_TYPE_NO_CONST(group_replication_message_service_recv);
bool result = reg->register_service(
"group_replication_message_service_recv.listener_example",
reinterpret_cast<my_h_service>(
const_cast<group_replication_message_service_recv_t *>(
listener_example,
group_replication_message_service_recv))));
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
mysql_service_status_t recv(const char *tag, const unsigned char *data, size_t data_length) noexcept
Definition: gr_message_service_example.cc:39
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
#define SERVICE_TYPE_NO_CONST(name)
Generates the standard Service type name.
Definition: service.h:71
#define BEGIN_SERVICE_IMPLEMENTATION(component, service)
Declares a Service Implementation.
Definition: service_implementation.h:62
#define END_SERVICE_IMPLEMENTATION()
A macro to end the last declaration of a Service Implementation.
Definition: service_implementation.h:67
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
#define SERVICE_IMPLEMENTATION(component, service)
Reference to the name of the service implementation variable.
Definition: service_implementation.h:51
const mysql_service_registry_t * mysql_plugin_registry_acquire()
Returns a new reference to the "registry" service.
Definition: plugin_registry_service.cc:47
Definition: result.h:30