Feature request

7 views
Skip to first unread message

Andrey Deykunov

unread,
Sep 2, 2021, 12:12:29 PM9/2/21
to SObjectizer
Hi Eugene,

It would be nice to have an overloaded method so_5::send returning some result of enqueuing the message to some mbox. Suppose I have two actors (A1 and B1) located in different parts of the program and very far from each other in the hierarchy. These actors do not know anything about each other and any conversations between them performs through their supervisors (parents):

1.drawio.png

But sometimes, in  performance purposes, they're entering into a short dialog directly bypassing the supervisors through their own mboxes :

2.drawio.png

In this case, if A Supervisor deletes A1 actor, and B1 actor sends a message to A1 at the same time, the B1 must to know that the message will never be handled, and then B1 will change it's state accordingly. 


Thanks,
Andrey

   




Yauheni Akhotnikau

unread,
Sep 2, 2021, 1:17:12 PM9/2/21
to SObjectizer
Hi!

There are at least two reasons not to add such a feature.

The first reason is the async nature of communication. Successful enqueueing of a message doesn't mean that this message will be delivered to the receiver. Even if the message will be delivered (dequeued from the queue), it doesn't mean that it will be handled: the message can be rejected by some overload-protecting scheme, for example.

So, agent B1 has no guarantees that the message will be handled even if send will tell that message is enqueued.

The second reason is the possibility of creating custom mboxes with very different logic. For example, some type of mboxes can store messages even if there are no subscribers yet. Some types can drop messages if they are not dequeued in a specified time window. And so on. Because you don't know what mbox is behind `abstract_message_box_t` interface, the return code from the `send` function doesn't tell you the truth.

In cases as you described, something like `delivery_receipt` is required. A kind of notification about accepting or declining of the message by the receiver. Such notification can be implemented by using "enveloped messages" (https://github.com/Stiffstream/sobjectizer/wiki/SO-5.7-InDepth-Enveloped-Messages). A simple example of delivery receipt implementation can be found in the so5extra project: https://github.com/Stiffstream/so5extra/blob/master/dev/sample/so_5_extra/enveloped_msg/delivery_receipt/main.cpp (see also corresponding sections of so5extra's Wiki: https://github.com/Stiffstream/so5extra/wiki/so5extra-1.4-docs).

Andrey Deykunov

unread,
Sep 3, 2021, 9:12:32 AM9/3/21
to sobje...@googlegroups.com
Thanks Eugene, your solution seems to be helpful. 

Andrey

чт, 2 сент. 2021 г. в 20:17, Yauheni Akhotnikau <eao...@gmail.com>:
--
Вы получили это сообщение, поскольку подписаны на одну из тем в группе "SObjectizer".
Чтобы отменить подписку на эту тему, перейдите по ссылке https://groups.google.com/d/topic/sobjectizer/lDtWxVdKeYw/unsubscribe.
Чтобы отменить подписку на эту группу и все ее темы, отправьте письмо на электронный адрес sobjectizer...@googlegroups.com.
Чтобы посмотреть обсуждение на веб-странице, перейдите по ссылке https://groups.google.com/d/msgid/sobjectizer/2b75231a-f168-449d-b873-1152e24df691n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages