[Question] How to publish without subscriber with historical message?
See original GitHub issueIssue Description
After some testing with both pub/sub and xadd/xread I have came to a situation where I have realized that if my subscriber is not on, the message will not be recieved whenever I start up the subscriber. e.g. situation
- You send a message via publish
- You turn on your subscriber and listen for the channel 10 seconds after you have send the message via publish
- The message will be lost.
There is two different codes that I have tried e.g.
from walrus import *
import time
from config import configuration
client = Walrus(
host=configuration.helheim.redis_host,
port=configuration.helheim.redis_port,
db=configuration.helheim.redis_database
)
stream = client.Stream('sns')
while True:
test = stream.read()
print(test)
# How to delete after read?
time.sleep(3)
from walrus import *
from config import configuration
client = Walrus(
host=configuration.helheim.redis_host,
port=configuration.helheim.redis_port,
db=configuration.helheim.redis_database
)
stream = client.Stream('sns')
test = stream.add({"status": "start", "link": "https://www.sneakersnstuff.com/sv/product/49769/salomon-xa-alpine-mid-advanced"})
print(test)
EVENT_LISTENER.subscribe("sns")
while True:
message = EVENT_LISTENER.get_message()
if message and not message['data'] == 1:
message = json.loads(message['data'])
import redis
from config import configuration
client: redis = redis.Redis(
host=configuration.helheim.redis_host,
port=configuration.helheim.redis_port,
db=configuration.helheim.redis_database
)
channel = "sns"
client.publish(channel,
'{"status": "kill", "store": "sns", "link": "https://www.sneakersnstuff.com/sv/product/49769/salomon-xa-alpine-mid-advanced"}')
and it seems like there is no persist historical messages saved in the redis.
My question is, how am I able to read the messages that I have publish and remove after a read when I have turned on my subcriber?
Hopefully you guys wont me mad at me for asking this question! 😦
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
[Question] How to publish without subscriber with historical ...
The message will be lost. There is two different codes that I have tried e.g. ... and it seems like there is no...
Read more >python 3.x - How to publish without subscriber - Stack Overflow
My question is, how am I able to read the messages that I have publish and remove after a read when I have...
Read more >The publish-subscribe pattern: garbage-collecting old ...
1 Answer 1 · Do not guarantee delivery. · Keep a log of all messages, and let subscribers request re-transmission of all messages...
Read more >Get message published before subscriber start - ROS Answers
I created the subscription with a QoS History depth of 10 (according to the documentation), but this message is not retrieved (but QoS ......
Read more >Replaying and purging messages | Cloud Pub/Sub ...
Configuring a topic with message retention gives you more flexibility, allowing any subscription attached to the topic to seek back in time and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Streams are similar but for your usage I think using lists is the “correct” approach. You’re not using any of the stream-specific functionality, you’ve just implemented a more hacky version of the list push/pop (in my opinion).
Indeed and I agree! I appreciate your help and answer! It means alot for me and I wish you a nice day and evening!