Update 2: After more investigation, eliminating the ClientPoller, it seems like the culprit is calling OpenStream() with a different bucketId. As far as I can tell, this is the very first call on this bucket, so why is there an open DataReader!?
Update: I was too hasty on this one. Ran a new test today, the synchronous code runs just fine. The problem starts when the poller interacts with asynchronous code!
Soon after my code runs, I get the following exception:
An exception of type 'NEventStore.Persistence.StorageUnavailableException'
occurred in NEventStore.dll but was not handled in user code
Additional information: There is already an open DataReader associated with
this Command which must be closed first.
As far as I can tell, I don't have direct access to any DataReader and find this error strange when I use the api. There's no way I can close it. That said, I haven't found any documentation for the PollingClient, so it could be experimental for what I know.
The PollingClient takes an IPersistStreams in its constructor, and the only way I have found to do that, is to pass store.Advanced:
var streams = Wireup.Init()
.UsingInMemoryPersistence()
.UsingSqlPersistence("EventStore").WithDialect(new MsSqlDialect())
.InitializeStorageEngine()
.UsingJsonSerialization()
.Build().Advanced;
poller = new PollingClient(streams, 500);
Each bounded context have their own instance of the store, so that shouldn't be the root cause:
One context work with a separate service, asynchronously, but the exception is still thrown after I deactivate it.
The other context using the PollingClient updates a database table directly without any additional async code.
Now, if an IPersisStreams is supposed to be disposed after each use, then I am kind of stuck because there is nowhere I can dispose it.
I was planning to set up my bounded contexts asynchronously and though setting up a PollingClient for each one would be easiest.
Soon after my code runs, I get the following exception:
As far as I can tell, I don't have direct access to any
DataReader
and find this error strange when I use the api. There's no way I can close it. That said, I haven't found any documentation for thePollingClient
, so it could be experimental for what I know.The
PollingClient
takes anIPersistStreams
in its constructor, and the only way I have found to do that, is to passstore.Advanced
:Each bounded context have their own instance of the store, so that shouldn't be the root cause:
PollingClient
updates a database table directly without any additional async code.Now, if an
IPersisStreams
is supposed to be disposed after each use, then I am kind of stuck because there is nowhere I can dispose it.