A great way to chat about all Mongock questions, spread the knowlegde, share thoughts and even help where we can!
We have now a Gitter community to chat about All Mongock things π₯³
Some useful links:
Happy chatting! π€
import com.github.cloudyrock.mongock.ChangeLog
for import io.mongock.ChangeLog
but that didn't work.
I have a situation in my Spring Boot app where I need to create default users within the MongoDB database, but I have to then invoke an external call to register the user in a cloud-based Authentication server. The call to the external Authentication server fails with an error when it makes the outbound call. I'm guessing that perhaps the ApplicationContext is not fully started and available for fully application functionality?
When I attempt to debug the code, my injected class "AuthenticationServer" doesn't even get executed when I call "authenticationServer.register(user)" and place a breakpoint within this method. This is leading me to believe that the Spring context isn't ready or something is up with the Change Unit logic?
Hi Tim! Mongock creates a proxy for every injected dependency in the ChangeUnitβs methods as parameters. The proxy is a mechanism to ensure Mongock has the lock acquired. If you annotate the param with @NonLockGuarded you are preventing Mongock to create a proxy for it. In your case, you can omit proxy for that service, because this SSO authentication doesn't required synchronisation. This synchronisation is critical specially for DB writes.
Said that, that proxy only ensures the lock is acquired in every i/o method call. There is a daemon in charge of acquiring and maintaining the lock. So realistically speaking , even that SSO call is also synchronised.
Hello, we are trying mongock examples provided in https://github.com/mongock/mongock-examples. When we build "jar" for "springboot-quickstart" example and then, run with mongock CLI, we get the following exception:
io.mongock.api.exception.MongockException: Operation 'MIGRATION' not found. It may be a professional operation and the professional library is not provided
at io.mongock.runner.core.executor.ExecutorBuilderDefault.getExecutorByOperation(ExecutorBuilderDefault.java:22)
at io.mongock.runner.core.executor.ExecutorBuilderBase.buildExecutor(ExecutorBuilderBase.java:69)
at io.mongock.runner.core.builder.RunnerBuilderBase.buildExecutor(RunnerBuilderBase.java:248)
at io.mongock.runner.core.builder.RunnerBuilderBase.buildRunner(RunnerBuilderBase.java:143)
at io.mongock.runner.core.builder.RunnerBuilderBase.buildRunner(RunnerBuilderBase.java:129)
at io.mongock.cli.core.commands.migrate.MigrateCommand.call(MigrateCommand.java:27)
at io.mongock.cli.core.commands.migrate.MigrateCommand.call(MigrateCommand.java:13)
...
Could you help me with this topic? Is there a licensed version or are all the features open source?.
Thanks you!
Hello, I would like to perform undo operation (./mongock undo all) on the provided example (standalone-springdata) but I get the following error:
picocli.CommandLine$ExecutionException: Error while calling command (public java.lang.Integer io.mongock.cli.core.commands.undo.UndoCommand.all()): java.lang.NoClassDefFoundError: io/mongock/professional/runner/common/executor/operation/undo/UndoAllOperation
at picocli.CommandLine.executeUserObject(CommandLine.java:1986)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at io.mongock.cli.core.CommandLineDecorator.execute(CommandLineDecorator.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.mongock.cli.wrapper.launcher.LauncherStandalone.executeCli(LauncherStandalone.java:94)
at io.mongock.cli.wrapper.launcher.LauncherStandalone.launch(LauncherStandalone.java:71)
at io.mongock.cli.wrapper.MongockCli.main(MongockCli.java:52)
Caused by: java.lang.NoClassDefFoundError: io/mongock/professional/runner/common/executor/operation/undo/UndoAllOperation
at io.mongock.cli.core.commands.undo.UndoCommand.all(UndoCommand.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at picocli.CommandLine.executeUserObject(CommandLine.java:1972)
... 14 more
Caused by: java.lang.ClassNotFoundException: io.mongock.professional.runner.common.executor.operation.undo.UndoAllOperation
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:814)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 20 more
Could you give me some hints? is it due to the missing PRO version? How can I get it?
(Normal migration operations works properly)
Hi, I was looking at changes for mongock/mongock#508, I noticed that we had a lot of methods which have param of Class<?> changeUnitClass
in AnnotationProcessor.class
which need not be there and are useful in other part of code as well. For example, I have to make changes to ChangeLogRuntimeImpl.getConstructor
which again will need to repeat logic which is somewhat already there in AnnotationProcessor
I propose to create a new domain object, something like ChangeUnitClassDO
which has a field of Class<?> changeUnitClass
So, any method that needs to do something to or on a changeUnitClass, can do for examplechangeUnitClassDO.getBeforeMethod()
, changeUnitClassDO.findMethodByAnnotation(RollbackBeforeExecution.class)
etc
What do you guys think?