How to use maapi_request_action_th

Hi,

Can anyone please tell me how can we use below function to use transaction in action callpoint.

int maapi_request_action_th(int sock, int thandle, confd_tag_value_t
*params, int nparams, confd_tag_value_t **values, int *nvalues, const
char *fmt, …);

Regards,
Anup Agrawal

Hi,

maapi_request_action_th() is used to invoke an action. It is not normally used from an action callpoint that was called because an action was invoked.

See the confd_lib_dp(3) man page for details.

Hi cohult,

thanks for the response.
If i want to start the write transaction from action callpoint which steps i need to follow. Because, when i am trying to start normal CDB_RUNNING session, Confd getting stuck on apply_transaction function.

Below process i followed to start transaction from action callpoint,
/* Session creation */
CDA_CONFD_FATAL(CDA_maapi_start(CDB_RUNNING, &th, IMMEDIATE));
CDA_maapi_set_namespace(th, core_model__ns);

     maapi_ret = CDA_maapi_exists(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid);

     if(CONFD_TRUE != maapi_ret)
     {
         CDA_CONFD_FATAL(CDA_maapi_create(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid));
         CDA_CONFD_FATAL(CDA_maapi_cd(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid));

         /* set the vlan-fc local id */
         CDA_SET_STR(&vt, vlanFc_localId);
         CDA_CONFD_FATAL(CDA_maapi_set_elem(th, &vt, CORE_MODEL_LOCAL_ID_ENT));

     }
     else
     {
         printf("RPC instance for given vlan ID already exists");
     }

     CDA_CONFD_FATAL(CDA_maapi_apply_trans(th));
     CDA_CONFD_FATAL(CDA_maapi_end(th));

Regards,
Anup

Hi,

Start a separate thread/process that perform the transaction if your action handler thread also handle subscriptions or other callpoints triggered by the commit (apply).

Regards

Hi Cohult,

What if the action handler is expected to reply a value based on DB commit success.

As pee the above suggestion , it is expected to open a separate thread to perform commit (the configuration)

Please share further inputs.

Regards,
Chandra