MqContextC - setup and manage a storage used to persist data-packages … More...
Functions | |
enum MkErrorE | MqStorageErrCnt_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR transLId, MK_I32 *cnt_out) |
increment and return the database row-error-count for the row defined with transLId | |
enum MkErrorE | MqStorageOpen_RT (MK_RT mkrt, MQ_CTX const ctx, MK_STRN const storageFile) |
switch to a file-based-transaction-database … | |
enum MkErrorE | MqStorageClose_RT (MK_RT mkrt, MQ_CTX const ctx) |
close the storage. … | |
enum MkErrorE | MqStorageExport_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR *ltid_out) |
export the read-data-package into the STORAGE … | |
enum MkErrorE | MqStorageImport_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR *transLIdP_inout) |
import the storage-package into the read-data-package … | |
enum MkErrorE | MqStorageIncrRef_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR transLId) |
increase the internal refCount lock of the database-entry | |
enum MkErrorE | MqStorageDecrRef_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR transLId) |
decrease the internal refCount lock of the database-entry | |
enum MkErrorE | MqStorageDelete_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR *transLIdP_inout) |
delete the storage-row identified by the transLIdP_inout … | |
enum MkErrorE | MqStorageCount_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_LTR *cnt_out) |
count the number of storage-rows … | |
enum MkErrorE | MqStorageResolve_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_CTX *otherCtxP_out, MQ_LTR *otherLIdP_out) |
extract the context->link.protect.rmtTransLId entry from the database | |
MqStorageLog | |
enum MkErrorE | MqStorageLog_RT (MK_RT mkrt, MQ_CTX const ctx, MK_STRN const callfunc) |
log the storage the status of the open transactions | |
MqContextC - setup and manage a storage used to persist data-packages …
The storage is divided into: INTERNAL and EXTERNAL storage. Only the read-data-package can be stored or dumped into the storage.
The read-data-package is saved into the storage using:
ServiceStorage | setup a service listen on a MqContextC_ServiceApi_Identifer and save all read-data-package into the STORAGE … |
StorageExport | export the read-data-package into the STORAGE … |
The read-data-package is restored from the storage using:
StorageImport | import the storage-package into the read-data-package … |
ProxyForward | send the entire read-data-package-data to the link-target … |
All this usually happen in an Event Handler |
Some important facts of the storage-feature:
The following internal storages are supported:
Performance analyse:
Nhi1Exec perfclient.c --all --storage VALUE @ perfserver.c
.database | performance | host crash | application crash | info |
---|---|---|---|---|
memdb | 30.000 | data lost | data lost | non persistent |
tempdb | < 30.000 | data lost | data lost | uses memory and/or temporary file |
filedb (mem) | 10.000 | data lost | data safe | in memory filesystem |
filedb (disc) | 50 | data safe | data safe | disc-speed is the key factor |
#define MqStorageClose | ( | ... | ) |
Definition at line 811 of file msgque_overload_mq.h.
#define MqStorageClose_C | ( | ... | ) |
Definition at line 813 of file msgque_overload_mq.h.
#define MqStorageClose_E | ( | ... | ) |
Definition at line 812 of file msgque_overload_mq.h.
#define MqStorageClose_NULL | ( | ... | ) |
Definition at line 810 of file msgque_overload_mq.h.
#define MqStorageCount | ( | ... | ) |
Definition at line 834 of file msgque_overload_mq.h.
#define MqStorageCount_C | ( | ... | ) |
Definition at line 836 of file msgque_overload_mq.h.
#define MqStorageCount_E | ( | ... | ) |
Definition at line 835 of file msgque_overload_mq.h.
#define MqStorageCount_e | ( | ... | ) |
Definition at line 837 of file msgque_overload_mq.h.
#define MqStorageCount_NULL | ( | ... | ) |
Definition at line 833 of file msgque_overload_mq.h.
#define MqStorageDecrRef | ( | ... | ) |
Definition at line 815 of file msgque_overload_mq.h.
#define MqStorageDecrRef_C | ( | ... | ) |
Definition at line 817 of file msgque_overload_mq.h.
#define MqStorageDecrRef_E | ( | ... | ) |
Definition at line 816 of file msgque_overload_mq.h.
#define MqStorageDecrRef_NULL | ( | ... | ) |
Definition at line 814 of file msgque_overload_mq.h.
#define MqStorageDelete | ( | ... | ) |
Definition at line 797 of file msgque_overload_mq.h.
#define MqStorageDelete_1 | ( | ctx | ) |
Definition at line 798 of file msgque_overload_mq.h.
#define MqStorageDelete_C | ( | ... | ) |
Definition at line 800 of file msgque_overload_mq.h.
#define MqStorageDelete_E | ( | ... | ) |
Definition at line 799 of file msgque_overload_mq.h.
#define MqStorageDelete_e | ( | ... | ) |
Definition at line 801 of file msgque_overload_mq.h.
#define MqStorageDelete_NULL | ( | ... | ) |
Definition at line 796 of file msgque_overload_mq.h.
#define MqStorageErrCnt | ( | ... | ) |
Definition at line 839 of file msgque_overload_mq.h.
#define MqStorageErrCnt_C | ( | ... | ) |
Definition at line 841 of file msgque_overload_mq.h.
#define MqStorageErrCnt_E | ( | ... | ) |
Definition at line 840 of file msgque_overload_mq.h.
#define MqStorageErrCnt_e | ( | ... | ) |
Definition at line 842 of file msgque_overload_mq.h.
#define MqStorageErrCnt_NULL | ( | ... | ) |
Definition at line 838 of file msgque_overload_mq.h.
#define MqStorageExport | ( | ... | ) |
Definition at line 844 of file msgque_overload_mq.h.
#define MqStorageExport_C | ( | ... | ) |
Definition at line 846 of file msgque_overload_mq.h.
#define MqStorageExport_E | ( | ... | ) |
Definition at line 845 of file msgque_overload_mq.h.
#define MqStorageExport_e | ( | ... | ) |
Definition at line 847 of file msgque_overload_mq.h.
#define MqStorageExport_NULL | ( | ... | ) |
Definition at line 843 of file msgque_overload_mq.h.
#define MqStorageImport | ( | ... | ) |
Definition at line 803 of file msgque_overload_mq.h.
#define MqStorageImport_1 | ( | ctx | ) |
Definition at line 804 of file msgque_overload_mq.h.
#define MqStorageImport_C | ( | ... | ) |
Definition at line 806 of file msgque_overload_mq.h.
#define MqStorageImport_E | ( | ... | ) |
Definition at line 805 of file msgque_overload_mq.h.
#define MqStorageImport_e | ( | ... | ) |
Definition at line 807 of file msgque_overload_mq.h.
#define MqStorageImport_NULL | ( | ... | ) |
Definition at line 802 of file msgque_overload_mq.h.
#define MqStorageIncrRef | ( | ... | ) |
Definition at line 819 of file msgque_overload_mq.h.
#define MqStorageIncrRef_C | ( | ... | ) |
Definition at line 821 of file msgque_overload_mq.h.
#define MqStorageIncrRef_E | ( | ... | ) |
Definition at line 820 of file msgque_overload_mq.h.
#define MqStorageIncrRef_NULL | ( | ... | ) |
Definition at line 818 of file msgque_overload_mq.h.
#define MqStorageLog | ( | ... | ) |
Definition at line 823 of file msgque_overload_mq.h.
#define MqStorageLog_1 | ( | ctx | ) |
Definition at line 824 of file msgque_overload_mq.h.
#define MqStorageLog_1 | ( | ctx | ) |
Definition at line 5106 of file LibMqMsgque_mq.h.
#define MqStorageLog_C | ( | ... | ) |
Definition at line 826 of file msgque_overload_mq.h.
#define MqStorageLog_E | ( | ... | ) |
Definition at line 825 of file msgque_overload_mq.h.
#define MqStorageLog_NULL | ( | ... | ) |
Definition at line 822 of file msgque_overload_mq.h.
#define MqStorageOpen | ( | ... | ) |
Definition at line 828 of file msgque_overload_mq.h.
#define MqStorageOpen_C | ( | ... | ) |
Definition at line 830 of file msgque_overload_mq.h.
#define MqStorageOpen_E | ( | ... | ) |
Definition at line 829 of file msgque_overload_mq.h.
#define MqStorageOpen_NULL | ( | ... | ) |
Definition at line 827 of file msgque_overload_mq.h.
#define MqStorageResolve | ( | ... | ) |
Definition at line 849 of file msgque_overload_mq.h.
#define MqStorageResolve_C | ( | ... | ) |
Definition at line 851 of file msgque_overload_mq.h.
#define MqStorageResolve_E | ( | ... | ) |
Definition at line 850 of file msgque_overload_mq.h.
#define MqStorageResolve_NULL | ( | ... | ) |
Definition at line 848 of file msgque_overload_mq.h.
close the storage. …
the next storage request will open the storage again with the location from Storage
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
count the number of storage-rows …
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[out] | cnt_out | number of rows, OLL if nothing is available |
decrease the internal refCount lock of the database-entry
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | transLId | storage-id … return from MqStorageImport |
delete the storage-row identified by the transLIdP_inout …
The transLIdP_inout is the value returned by a previous MqStorageImport. If transLIdP_inout is MK_NULL
than OLL
is used. MqStorageImport and MqStorageDelete work together link an transaction and every successfull transcation have to delete the transLIdP_inout out of the storage. After sucessfull delete the transLIdP_inout is set to 0LL
, on error the initial value is unchanged.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in,out] | transLIdP_inout | pointer to storage-id to delete, will be 0LL on success |
enum MkErrorE MqStorageErrCnt_RT | ( | MK_RT | mkrt, |
MQ_CTX const | ctx, | ||
MQ_LTR | transLId, | ||
MK_I32 * | cnt_out ) |
increment and return the database row-error-count for the row defined with transLId
The storage is typical used in the following workflow:
<----- AT CALLING CLIENT ----->|<----- AT RECEIVING SERVER -----> | *setup transaction | make service-request --> *start service-handler | save request into storage wait for confirmation <-- confirm data receiving | *stop service-handler ==================== enter event loop ===================== | *start event-handler | load reqest from storage | process data *start transaction <-- send result-data process result-data | *stop event-handler *stop transaction |
Example Filter6 - store incoming packages into storage
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | transLId | storage-id … return from MqStorageImport |
[out] | cnt_out | the new value or -1 on error |
export the read-data-package into the STORAGE …
The export include all data required to setup a read-data-package later again. After import with MqStorageImport the read-data-package and the environment will be set as it was on MqStorageExport
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[out] | ltid_out | if ltid_out != NULL return the storage-id |
import the storage-package into the read-data-package …
Select the read-data-package from the database using the transLIdP. Only a package with refCount = 0
will be selected.
After selection the refCount is incremented and the next call to MqStorageImport using the same transLId will fail.
MqStorageImport is used together with MqStorageDelete or MqStorageDecrRef to delete the selected package from database or to undo the select.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) | ||||||||||
[in] | ctx | the MqContextS instance to work on | ||||||||||
[in,out] | transLIdP_inout | storage-id or MK_NULL or 0 … return from MqStorageExport
|
refCount=0
) with the smallest transLId
is read.refCount
is not reset or the package is not deleted, then the package remains locked and a subsequent call to MqStorageImport will read the next free package.increase the internal refCount lock of the database-entry
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | transLId | storage-id … return from MqStorageImport |
log the storage the status of the open transactions
switch to a file-based-transaction-database …
the value can also be set using the --storage
commandline option.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | storageFile | the file used to create the transaction-database. Allowed values are:
|
enum MkErrorE MqStorageResolve_RT | ( | MK_RT | mkrt, |
MQ_CTX const | ctx, | ||
MQ_CTX * | otherCtxP_out, | ||
MQ_LTR * | otherLIdP_out ) |
extract the context->link.protect.rmtTransLId
entry from the database
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[out] | otherCtxP_out | the ctx of the resolve |
[out] | otherLIdP_out | the transLId of the resolve |