MCPcopy Create free account
hub / github.com/acl-dev/acl / xreadgroup_loop

Function xreadgroup_loop

lib_acl_cpp/samples/redis/redis_stream/redis_stream.cpp:311–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311static void xreadgroup_loop(acl::redis_stream& redis, const char* group,
312 const char* consumer, size_t count)
313{
314 std::map<acl::string, acl::string> streams;
315 streams[__key] = ">";
316 size_t n = 0;
317 while (true) {
318 acl::redis_stream_messages messages;
319 if (!redis.xreadgroup(messages, group, consumer, streams,
320 count, 1000, true)) {
321
322 printf("%s: error=%s, key=%s, group=%s, consumer=%s\r\n",
323 __FUNCTION__, redis.result_error(), __key.c_str(),
324 group, consumer);
325 break;
326 }
327
328 n += messages.size();
329 if (n > 0 && n % 1000 == 0) {
330 printf("xreadgroup ok, key=%s, group=%s, consumer=%s, "
331 "count=%lu, total=%lu\r\n", __key.c_str(),
332 group, consumer, messages.size(), n);
333 }
334
335 redis.clear();
336 }
337}
338
339static void xrange(acl::redis_stream& redis, size_t count)
340{

Callers 1

mainFunction · 0.85

Calls 5

xreadgroupMethod · 0.80
result_errorMethod · 0.80
c_strMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…