Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

publish before serving? #16

Open
jcw opened this issue Mar 15, 2015 · 3 comments
Open

publish before serving? #16

jcw opened this issue Mar 15, 2015 · 3 comments

Comments

@jcw
Copy link

jcw commented Mar 15, 2015

Q: Is it possible to publish topics to the server before it starts serving network requests?

This might make it possible to implement persistent retains as a separate process: i.e. log all retained messages to file or some database via a listener subscribed to "#", then on startup have the server go through the saved data and "pre-publish" them as a way to prime the in-memory cache of SurgeMQ.

-jcw

@ankoh
Copy link

ankoh commented Jan 6, 2016

Right now the retained messages are stored in a Topic-Trie.
So they are just as persistent as any other message in the broker (that is in-memory-only atm).
I don't see the point in implementing persistency for retained messages when everything else is still in-memory.
(A solution to the broker-wide persistency problem most probably brings in the retained message persistency)

@jcw
Copy link
Author

jcw commented Jan 21, 2016

So if I understand it correctly, I can call func (*Server) Publish on the server between the creation of that Server object and the call to func (*Server) ListenAndServe? This would allow pre-loading retained messages before the first client has a chance to connect, which is exactly what I'm after.

@ankoh
Copy link

ankoh commented Jan 26, 2016

@jcw you need to tag me if you want me to read that in time. ;)

In theory - yes.
ListenAndServe is only responsible for instantiating new sessions for incoming TCP connections.
But I rewrote that part completely so I cannot assure you that it will work our of the box.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants