Using a transaction listener with an embedded instance

Hi, after a bit of struggling with Maven I'm now able to run an application using an embedded Stardog.
Now I'd like to attach a transaction listener to it.
I see there is a good example here: however I cannot understand how to attach the listener to the embedded instance of Stardog I just created. I see the example uses a guice to inject the the listener but the missing part is how to use the injector configured with this module:
Should the injector configured with that module return a Connection, an AdminConnection?
Do you have a simple two-liners to show how to use it?

BTW the link to " 9. Transaction Listener" in List of Examples here is wrong (404).

I don’t believed that the listener is defined for a specific connection but listens on all connections. It will be looked up my the service definition and injected. There shouldn’t be anything specific you need to do for embedded mode. It’s all automagic.

But do I have to create an Injector or I don't?

The example you refer to is for an embedded connection already. You need the Guice module definition as in that example but do not need to create an injector explicitly which is done by Stardog internals. You need the service loader file [1] so Stardog will include use your Guice module.



Gotcha. That was the piece I was missing. Thanks.

The correct link would most likely be stardog-examples/examples/connectable at develop · stardog-union/stardog-examples · GitHub

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.