diff --git a/docs/sphinx/essentials.rst b/docs/sphinx/essentials.rst index 30d5ea9b50419b10bd4553b23f8d6246f98b9bf3..643ddaf325d0b2261d67c4c9500e112c3726a219 100644 --- a/docs/sphinx/essentials.rst +++ b/docs/sphinx/essentials.rst @@ -221,7 +221,7 @@ Then events may be polled mstro_subscription_poll(cdo_subscription, &event); .. NOTE:: - ``mstro_subscription_poll()`` returns in *event* a list of events, where *event* is the head and where the next element is event->next. + ``mstro_subscription_poll()`` returns in *event* a list of events, where *event* is the head and where the next element is ``event->next``. and inspected for CDO properties @@ -265,7 +265,7 @@ elements may be inspected before being potentially individually ``required``. -.. WARNING:: +.. NOTE:: * All group participant must know all CDOs, at least their names * Consumer must know all CDO names at least diff --git a/maestro/subscription_registry.c b/maestro/subscription_registry.c index 0ccd7c6d38674d2a7e0ced83c0e17f8101743a33..88851bf4051227ed2cb891d45e6dec954006fb56 100644 --- a/maestro/subscription_registry.c +++ b/maestro/subscription_registry.c @@ -1986,6 +1986,28 @@ mstro_pool_event_consume(const Mstro__Pool__Event *eventmsg) ev->require.cdo_name, ev->require.appid); break; + case MSTRO_POOL_EVENT_DEMAND: + assert(eventmsg->payload_case==MSTRO__POOL__EVENT__PAYLOAD_DEMAND); + assert(eventmsg->origin_id!=NULL + && eventmsg->origin_id->id!=MSTRO_APP_ID_INVALID); + assert(eventmsg->demand->cdoid!=NULL); + ev->demand.appid = eventmsg->origin_id->id; + if(eventmsg->cdo_name==NULL) { + ERR("DEMAND event missing a CDO name\n"); + free(ev); + return MSTRO_FAIL; + } else { + ev->demand.cdo_name = strdup(eventmsg->cdo_name); + if(ev->demand.cdo_name == NULL) { + ERR("Failed to allocate event data\n"); + free(ev); + return MSTRO_NOMEM; + } + } + + DEBUG("Event: DEMAND for |%s| from %" PRIu64 "\n", + ev->demand.cdo_name, ev->demand.appid); + break; case MSTRO_POOL_EVENT_WITHDRAW: assert(eventmsg->payload_case==MSTRO__POOL__EVENT__PAYLOAD_WITHDRAW); assert(eventmsg->origin_id!=NULL @@ -2017,7 +2039,7 @@ mstro_pool_event_consume(const Mstro__Pool__Event *eventmsg) break; case MSTRO_POOL_EVENT_SEAL_GROUP: - case MSTRO_POOL_EVENT_DEMAND: + case MSTRO_POOL_EVENT_RETRACT: case MSTRO_POOL_EVENT_DISPOSE: case MSTRO_POOL_EVENT_TRANSPORT_INIT: