## AgsMessageDelivery

AgsMessageDelivery — message delivery singleton

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_MESSAGE_DELIVERY_GET_OBJ_MUTEX()
void | ags_message_delivery_set_message_queue ()
GList * | ags_message_delivery_get_message_queue ()
void | ags_message_delivery_add_message_queue ()
void | ags_message_delivery_remove_message_queue ()
GList * | ags_message_delivery_find_sender_namespace ()
GList * | ags_message_delivery_find_recipient_namespace ()
void | ags_message_delivery_add_message_envelope ()
void | ags_message_delivery_remove_message_envelope ()
GList * | ags_message_delivery_find_sender ()
GList * | ags_message_delivery_find_recipient ()
GList * | ags_message_delivery_query_message ()
AgsMessageDelivery * | ags_message_delivery_get_instance ()
AgsMessageDelivery * | ags_message_delivery_new ()

## Object Hierarchy

        GObject
        ╰── AgsMessageDelivery

## Includes

    #include <ags/thread/ags_message_delivery.h>

## Description

The AgsMessageDelivery acts as messages passing system. Obtain the singleton instance by calling `ags_message_delivery_get_instance()`.

To query the message queue for message envelopes there are functions like:

- ags_message_delivery_find_sender()

- ags_message_delivery_find_recipient()

- ags_message_delivery_query_message()

Make sure to cleanup the queue after you queried it.

ags_message_delivery_remove_message_envelope()

You instatiate a message queue with `sender-namespace` and `recipient-namespace`.

- ags_message_queue_new()

- ags_message_queue_set_recipient_namespace()

Then you subscribe to a message queue by calling

- ags_message_delivery_add_message_queue()

If you want to send a message, you first check if the AgsMessageQueue is available. Then you can add a message envelope by calling:

- ags_message_delivery_add_message_envelope()

## Functions

### AGS_MESSAGE_DELIVERY_GET_OBJ_MUTEX()

    #define AGS_MESSAGE_DELIVERY_GET_OBJ_MUTEX(obj) (&(((AgsMessageDelivery *) obj)->obj_mutex))

### ags_message_delivery_set_message_queue ()

    void
    ags_message_delivery_set_message_queue
                                   (AgsMessageDelivery *message_delivery,
                                    GList *message_queue);

Set `message_queue` of `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery |
message_queue | the GList containing AgsMessageQueue. | [element-type Ags.MessageQueue][transfer full]

Since: 3.6.16

### ags_message_delivery_get_message_queue ()

    GList *
    ags_message_delivery_get_message_queue
                                   (AgsMessageDelivery *message_delivery);

Get message queue of `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery |

#### Returns

the GList containing AgsMessageQueue.

[element-type Ags.MessageQueue][transfer none]

Since: 3.6.16

### ags_message_delivery_add_message_queue ()

    void
    ags_message_delivery_add_message_queue
                                   (AgsMessageDelivery *message_delivery,
                                    GObject *message_queue);

Add `message_queue` to `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery |
message_queue | the AgsMessageQueue |

Since: 3.0.0

### ags_message_delivery_remove_message_queue ()

    void
    ags_message_delivery_remove_message_queue
                                   (AgsMessageDelivery *message_delivery,
                                    GObject *message_queue);

Remove `message_queue` to `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery |
message_queue | the AgsMessageQueue |

Since: 3.0.0

### ags_message_delivery_find_sender_namespace ()

    GList *
    ags_message_delivery_find_sender_namespace
                                   (AgsMessageDelivery *message_delivery,
                                    gchar *sender_namespace);

Find sender namespace of AgsMessageQueue in `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery to search |
sender_namespace | the sender namespace as string to find |

#### Returns

the matching GList containing AgsMessageQueue or `NULL`.

[element-type Ags.MessageQueue][transfer full]

Since: 3.0.0

### ags_message_delivery_find_recipient_namespace ()

    GList *
    ags_message_delivery_find_recipient_namespace
                                   (AgsMessageDelivery *message_delivery,
                                    gchar *recipient_namespace);

Find recipient namespace of AgsMessageQueue in `message_delivery` .

#### Parameters

message_delivery | the AgsMessageDelivery to search |
recipient_namespace | the recipient namespace as string to find |

#### Returns

the matching GList containing AgsMessageQueue or `NULL`.

[element-type Ags.MessageQueue][transfer full]

Since: 3.0.0

### ags_message_delivery_add_message_envelope ()

    void
    ags_message_delivery_add_message_envelope
                                   (AgsMessageDelivery *message_delivery,
                                    gchar *sender_namespace,
                                    GObject *message_envelope);

Add `message` to an AgsMessageQueue specified by `sender_namespace` .

#### Parameters

message_delivery | the AgsMessageDelivery |
sender_namespace | the sender namespace as string |
message_envelope | the AgsMessageEnvelope |

Since: 3.0.0

### ags_message_delivery_remove_message_envelope ()

    void
    ags_message_delivery_remove_message_envelope
                                   (AgsMessageDelivery *message_delivery,
                                    gchar *sender_namespace,
                                    GObject *message_envelope);

Remove `message` from an AgsMessageQueue specified by `sender_namespace` .

#### Parameters

message_delivery | the AgsMessageDelivery |
sender_namespace | the sender namespace as string |
message_envelope | the AgsMessageEnvelope |

Since: 3.0.0

### ags_message_delivery_find_sender ()

    GList *
    ags_message_delivery_find_sender (AgsMessageDelivery *message_delivery,
                                      gchar *recipient_namespace,
                                      GObject *sender);

Find `sender` for `recipient_namespace` matching AgsMessageQueue. If `recipient_namespace` equals `NULL` match all available message queues.

#### Parameters

message_delivery | the AgsMessageDelivery |
recipient_namespace | the recipient namespace as string, maybe `NULL` |
sender | the sender as GObject |

#### Returns

all matching AgsMessageEnvelope as GList.

[element-type Ags.MessageEnvelope][transfer full]

Since: 3.0.0

### ags_message_delivery_find_recipient ()

    GList *
    ags_message_delivery_find_recipient (AgsMessageDelivery *message_delivery,
                                         gchar *recipient_namespace,
                                         GObject *recipient);

Find `recipient` for `recipient_namespace` matching AgsMessageQueue. If `recipient_namespace` equals `NULL` match all available message queues.

#### Parameters

message_delivery | the AgsMessageDelivery |
recipient_namespace | the recipient namespace as string, maybe `NULL` |
recipient | the recipient as GObject |

#### Returns

all matching AgsMessageEnvelope as GList.

[element-type Ags.MessageEnvelope][transfer full]

Since: 3.0.0

### ags_message_delivery_query_message ()

    GList *
    ags_message_delivery_query_message (AgsMessageDelivery *message_delivery,
                                        gchar *recipient_namespace,
                                        gchar *xpath);

Query `xpath` for `recipient_namespace` matching AgsMessageQueue. If `recipient_namespace` equals `NULL` match all available message queues.

#### Parameters

message_delivery | the AgsMessageDelivery |
recipient_namespace | the recipient namespace as string, maybe `NULL` |
xpath | the xpath to query |

#### Returns

all matching AgsMessageEnvelope as GList.

[element-type Ags.MessageEnvelope][transfer full]

Since: 3.0.0

### ags_message_delivery_get_instance ()

    AgsMessageDelivery *
    ags_message_delivery_get_instance ();

Get the AgsMessageDelivery instance.

#### Returns

the AgsMessageDelivery.

[transfer none]

Since: 3.0.0

### ags_message_delivery_new ()

    AgsMessageDelivery *
    ags_message_delivery_new ();

Create a new AgsMessageDelivery.

#### Returns

the new AgsMessageDelivery

Since: 3.0.0