How do we generate transaction logs ?
This is how I created Client
This how the query is executed
12 Replies
@TSC @Committer Any help on this ?
If you want to work with transaction logs (e.g. recovery), you need to use java
Yeah Okay, but please can you share something
@Bo
@Aiman Sharief check documentation regarding Transaction Log here: https://docs.janusgraph.org/advanced-topics/transaction-log/
Can I get any sample code, because the documentation seems unclear to me.
The documentation provides sample code. I’m not sure what exactly you are looking for as the documentation provides you both samples:
- how to register change processors
- how to build a transaction which uses your log message bus
@Oleksandr Porunov My requirement is - whenever a vertex is created / updated a transaction log must be generated which should have the properties created/updated.
I am not sure if you checked the documentation I posted above but that’s exactly what examples the documentation provides. I.e. any mutation operations (create / update / remove) is tracked by the transaction log.
There is also WAL available which tracks everything before transaction is committed or after transaction is committed.
Please, check the documentation and let us know if there are any sections which are confusing.
Since my code has the
remote connection
configured ; we have access to the client
. How would we generate tx log
one using the client
?are you using Java? As I said before, you need to use java
Yes I'll shift the code from scala to java.
@Bo @porunov Is there anything you could help on this?
The transaction log is processed on the server side and not on the client side.
Thus, you would need to create a log processor on your server side (as showed in the documentation). The log processor will be triggered anytime a mutation for that particular log happens.
You may potentially have many same log processors listening to the same log on each of your JanusGraph servers or just a single log processor if that’s what you are looking for.
You can use JanusGraph in embedded mode to open change processor OR you may send your groovy script using the remote connection. As you are using a remote connection, you may wish to connect to your JanusGraph server and send a groovy script which does exactly what documentation says (i.e. opens a log processor with your custom logic).
In case your server is secured against groovy scripts and you cannot send non-gremlin compliant scripts you may want to add your groovy script to the startup of GremlinServer (please, refer to TinkerPop documentation on how to attach your custom scripts to your servers).