Persistence whilst awaiting initial connection #333
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the options ConnectRetry and ConnectRetryInterval along with the code to implement them and enable messages to be stored whilst the connection is in progress. The aim is to enable Publish() to be called before a connection is established (the message will get added to the store and sent eventually).
This is useful in situations where the comms are unreliable and the system may need to shutdown for periods to reduce power use. With this change there is no need to write separate code to store messages that are generated before the connection comes up.
The majority of changes should only apply if the new flag is set to true; about the only change that will affect all users is moving the store open and set status to connect outside of the go routine (needed because a user could call connect() and then publish() immediately with this new option enabled).
There are also a few more locks to align connect/reconnect - I was going to separate out the connect code so that the same code could be used for connect & reconnect but figured that you would prefer a smaller change.
closes #332