Put trigger added via plugin directory is not fired against named sessions

19 views
Skip to first unread message

Serhii Chernov

unread,
May 23, 2016, 4:52:44 PM5/23/16
to RavenDB - 2nd generation document database
Hello everyone,

We faced with strange behavior - if simple put trigger is added to document store it will be fired (triggered) only against Default Database (system database in our case). 

Init of the store and trigger
var documentStore = new EmbeddableDocumentStore
{
     RunInMemory = true,                
     Configuration = { RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true }
};
documentStore.Initialize();
 
documentStore.DocumentDatabase.PutTriggers.Add(new AnyDocumentPutTrigger
{
     Database = documentStore.DocumentDatabase
});

documentStore.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("someDatabaseName", true);
// here trigger will be fired on system database with document put by command above !!!


using store
using (var session = documentStore.OpenAsyncSession("someDatabaseName"))
{
     await session.StoreAsync(new Doc {Id = "some id", Data = "some values"});
     await session.SaveChangesAsync();
}

Trigger will not be fired. Is trigger registered incorrectly?

We tried to register it via plugin folder - same result (fired for system but not for named session
PluginsDirectory = Path.GetDirectoryName(typeof(RevisionDocumentPutTrigger).Assembly.Location)


Help is much appreciated.

Thanks and regards,
Sergiy



Oren Eini (Ayende Rahien)

unread,
May 23, 2016, 4:54:01 PM5/23/16
to ravendb
A named session is a _different database_, and you added this manually to the specific db instnace.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Serhii Chernov

unread,
May 23, 2016, 5:13:25 PM5/23/16
to RavenDB - 2nd generation document database
Got it. Oren, what is the correct way to add new database and register trigger for it?

Thanks

Oren Eini (Ayende Rahien)

unread,
May 23, 2016, 5:15:33 PM5/23/16
to ravendb
Register that on the container, see the options.Catalog

Serhii Chernov

unread,
May 23, 2016, 5:32:40 PM5/23/16
to RavenDB - 2nd generation document database
Oren,

this helped! Thanks a lot!
Reply all
Reply to author
Forward
0 new messages