Comments (7)
I've left a comment on stackoverflow, please check it:
Looks like you used the continuation feature with boost. In that case, you should install boost first, enable the boost future support with -DREDIS_PLUS_PLUS_ASYNC_FUTURE=boost, and link boost with your application. Check this for detail.
from redis-plus-plus.
from redis-plus-plus.
As an additional question, is using only redis++_static.lib the same as using redis++.lib and redis++.dll?
redis++_static_lib is static library, while others are dynamic library. You can use either. It depends on whether you want to link it statically or dynamically.
if I subscribe to a channel as a "Subscriber or AsyncSubscriber" and am receiving messages, is it okay to subscribe to the channel additionally in a separate thread?
Do you mean that you have two threads, both threads subscribe to the same channel with different Subscriber
or AsyncSubscriber
? Yes, you can do that safely. Since different subscribers are dependent objects and has nothing to do with each other.
Regards
from redis-plus-plus.
Thank you for your help.
I solved the problem, I didn't figure out where it was working, but there seems to be some command that determines which header to use, boost or std, and copies the file.
As a result, async_utils.h, which uses std::future, was overwritten at build time, so when I tried to use boost::future as the build output lib, I got a link error.
My solution was to override the file to always overwrite async_utils.h with the boost version.
As an additional question, is using only redis++_static.lib the same as using redis++.lib and redis++.dll?
Also, if I subscribe to a channel as a "Subscriber or AsyncSubscriber" and am receiving messages, is it okay to subscribe to the channel additionally in a separate thread? The reason I ask is that I've seen it work without any issues when I've done it, but I'm wondering if this is the correct way to use it.
Redis++ is a great library that I really enjoy using. I really appreciate it.
Translated with www.DeepL.com/Translator (free version)
from redis-plus-plus.
I'm sorry. I think I may have misunderstood the meaning of my question, so let me rephrase it.
~MainThread
{
_AsyncSubscriber->on_meta([this](Subscriber::MsgType type, OptionalString OptionParamStr, long long num)
_AsyncSubscriber->on_message([this](std::string channel, std::string msg)
_AsyncSubscriber->on_pmessage([this](std::string pattern, std::string channel, std::string msg)
...
_AsyncSubscriber->psubscribe(pattern);
**// Receiving a message from an IO Thread...**
...
...
Make_SubThread()...
}
~SubThread
{
_AsyncSubscriber->psubscribe(addedPattern) //
_AsyncSubscriber->subscribe(addedChannel) //
}
After creating the _AsyncSubscriber in the main thread and registering each callback as above. subscribe to the channel, and then while it's Receiving the message I'm wondering if it's ThreadSafe to subscribe to additional channels in a subthread?
from redis-plus-plus.
Yes, the code you given is thread-safe.
Regards
from redis-plus-plus.
Thank you for your helpful reply. May you always be happy. Thank you so much
from redis-plus-plus.
Related Issues (20)
- [QUESTION] Role change is not handled correctly HOT 7
- [BUG] memory leak detected when calling AsyncRedisCluster::redis(sw::redis::StringView const&, bool) HOT 3
- [QUESTION] different behavior for async and sync cluster HOT 5
- Issue with Specific Redis Plus Plus Exceptions Not Being Caught HOT 6
- version info at compile HOT 4
- Use of REDIS_SSL_VERIFY_NONE probably needs to be documented HOT 1
- [BUG] "hiredis_features.h" race when doing multiple out-of-source tree builds HOT 2
- [FEATURE] apply new TLS settings after cert renewal HOT 6
- [QUESTION] How to control redis++ reconnect? such as reconnect interval, health status etc HOT 4
- [FEATURE] Request ReplyUPtr expose at Redis++ Async response HOT 4
- [BUG?]memory accumulation causes oom HOT 2
- [BUG] -DCMAKE_PREFIX_PATH not finding hiredis HOT 1
- request timeout[QUESTION] HOT 3
- [BUG] AsyncRedisCluster keep cost fd at idle state HOT 6
- [FEATURE] Support for LMOVE / BLMOVE HOT 2
- [QUESTION] Cluster slots polling HOT 6
- [QUESTION] Shared Connection pool for redis between services HOT 4
- [QUESTION] The program will be terminated when exception occurs during the automatic unlocking HOT 3
- how many nodes will redis cluster subscriber connect to HOT 6
- [QUESTION] Unable to use std::optional with redis++ with cpp17 on ubuntu HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-plus-plus.