Re: [Orclib-users] subscriptions/callback for Oracle AQ
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
From: vincent r. <vin...@ya...> - 2012-12-04 12:46:21
|
Hi Petr, I already have in my plans to add support to CQN.. OCILIB currently support CDN introduced in 10g. CQN is an extension of CDN and has been introduced in 11g. when I added support for CDN, I saw that subscription could be done against AQ. when I looked at it, i thought that implementing notifications just for being notified of enqueuing was not a priority. I may have misunderstood its pertinence. If I have well understood, you want to add event notification on AQ for being informed that a user has received a message into queue ? Kind of monitoring ? Or is there more information you want to get ? More information that the one you've exposed in your code are available Regards, vincent On Mon, Dec 3, 2012 at 7:53 PM, Petr Vaněk <pe...@ya...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > hi Vincent and gang, > > I'd like to introduce you an idea about an addon to DCN or CQN > notifications/callback ocilib framework - notifications and callback > API for Advanced Queueing (AQ). > > You can see it in this temporary git repository: > > https://github.com/pvanek/ocilib > > this is based on the latest ocilib 3.10.0 with these changes: > > > - - an initial support for AQ callback: > > https://github.com/pvanek/ocilib/commit/0b44a5247829ef52c61694cfc2187396f88ef62f > > Note: this is not a final code, I'd like to know your opinion first. > There is no doc etc. > > * backward compatibility stays as is - there are no changes in > existing public API > * new function OCI_SubscriptionRegisterAQ, similar to > OCI_SubscriptionRegister but it uses AQ's OCI_SUBSCR_NAMESPACE_AQ > subscription context (instead of OCI_SUBSCR_NAMESPACE_DBCHANGE) > * new functions OCI_EventGetAQQueueName and > OCI_EventGetAQConsumerName to get AQ related attributes from OCI_Event > OCI_Event structure has been expanded to hold AQ attributes. > > Here I'm not sure if it's a good idea to expanc existing OCI_Event or > create new AQ-only similar struct and related functions. I'm open to > suggestions here. > > a small example: > > #include "ocilib.h" > > #ifdef _WINDOWS > #define sleep(x) Sleep(x*1000) > #else > #include <unistd.h> > #endif > > #define wait_for_events() sleep(15) > > void event_handler(OCI_Event *event); > void error_handler(OCI_Error *err); > > int main(void) > { > OCI_Connection *con; > OCI_Subscription *sub; > OCI_Statement *st; > > printf("=> Initializing OCILIB in event mode...\n\n"); > > if (!OCI_Initialize(error_handler, NULL, OCI_ENV_EVENTS)) > return EXIT_FAILURE; > > con = OCI_ConnectionCreate("stimpy", "omquser", "omquser", > OCI_SESSION_DEFAULT); > > sub = OCI_SubscriptionRegisterAQ(con, "omquser.testaq", > event_handler, 5468, 0); > > wait_for_events(); > > OCI_ConnectionFree(con); > OCI_SubscriptionUnregister(sub); > OCI_Cleanup(); > return EXIT_SUCCESS; > } > > void error_handler(OCI_Error *err) > { > int err_type = OCI_ErrorGetType(err); > const char *err_msg = OCI_ErrorGetString(err); > > printf("** %s - %s\n", err_type == OCI_ERR_WARNING ? "Warning" : > "Error", err_msg); > } > > void event_handler(OCI_Event *event) > { > unsigned int type = OCI_EventGetType(event); > unsigned int op = OCI_EventGetOperation(event); > OCI_Subscription *sub = OCI_EventGetSubscription(event); > > printf("** Notification : %s\n\n", OCI_SubscriptionGetName(sub)); > printf("... Queue Name : %s\n", > OCI_EventGetAQQueueName(event)); > printf(". Consumer Name : %s\n", > OCI_EventGetAQConsumerName(event)); > > printf("\n"); > } > > > > > > - - pkg-config feature added (ocilib.pc): > > https://github.com/pvanek/ocilib/commit/6ba08629bb3be6229b19bae577af241fade2202c > This feature is ready to be merged. It allows easy use of ocilib in > cmake, autotools, and similar build tools > > cmake example: > find_package(PkgConfig) > pkg_check_modules(OCILIB REQUIRED ocilib>=3.10) > message(STATUS "includes: ${OCILIB_INCLUDE_DIRS}") > message(STATUS " libs: ${OCILIB_LIBRARIES}") > message(STATUS "lib dirs: ${OCILIB_LIBRARY_DIRS}") > > > > looking forward your comments, > petr > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (Darwin) > Comment: GPGTools - http://gpgtools.org > Comment: Using GnuPG with undefined - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJQvPU0AAoJEC8yRjM4uE2t7mUIAIKZw2C6kbylNE3ndmTSpl6t > xEjVpKxnrVtc65G3bXhk19b2HhiseMXjNqMLW80+1Q5IvOHF4rpJew8m5vS29Lq/ > HOOhKfSL1xa9N/MQ9oorMwi+eZDsK1MEJlh8e9okdSnrEoYkX9BRX7P0u0XyiPk7 > 3HiatyEkPKS1zh2PKqfQyeXKxweQloceDQbe8Q4RtseeG9yB3dylq2qjtsB/17MG > rqUNm8Dl8Ws1dxTyjfamjtSUxzRPVYIW0QjcH+bQlvlBxnBOgStQqBHT/34v5w1x > /LoPhXCUa7zlfXvRVP6F9JSKWQ+clm6my7rrL+2gLL4Z3VeMWqfg1IR+lkvQJaM= > =I1ma > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > Keep yourself connected to Go Parallel: > BUILD Helping you discover the best ways to construct your parallel > projects. > http://goparallel.sourceforge.net > _______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > -- Vincent Rogier |