how to use this TAP protocol?
Mon, 07/09/2012 - 00:08
I am studying on this TAP protocol and was wondering if I coud get some help on this.
I've designed simple testing source
static void tap_mutation_callback( libcouchbase_t instance, const void *cookie, const void *key, libcouchbase_size_t nkey, const void * data, libcouchbase_size_t nbytes, libcouchbase_uint32_t flags, libcouchbase_time_t exp, libcouchbase_cas_t cas, libcouchbase_vbucket_t vbucket, const void *es, libcouchbase_size_t nes ) { (void)instance; (void)cookie; (void)flags; (void)cas; (void)vbucket; (void)exp; string akey; string adata; string aes; akey.append( (char*)key, nkey ); adata.append( (char*)data, nbytes); aes.append( (char*)es, nes ); printf("[CALLBACK] key : %s, data : %s, es : %s \n", akey.c_str(), adata.c_str(), aes.c_str() ); } int main() { libcouchbase_t instance = libcouchbase_create( "172.16.0.117", "hi", "hello", "default", NULL ); libcouchbase_set_tap_mutation_callback( instance, tap_mutation_callback ); libcouchbase_connect( instance ); printf("CONNECTED\n"); libcouchbase_tap_filter_t filter = libcouchbase_tap_filter_create(); libcouchbase_tap_filter_set_keys_only( filter, 0 ); // while( 1 ) // {} libcouchbase_tap_filter_destroy( filter ); return 0; }
I think I am misunderstanding something since I ain't getting any callbacks. can anyone help me understand how this tap can be used?
I'd recommend looking into the TAP unit tests built into the client.
See https://github.com/couchbase/couchbase-java-client/blob/master/src/test/...