-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize completion of publications to issue by-identifier query #258
Comments
Hello, Is there any timeline for this issue? |
We have a prototype working that flips the completion to a by-identifier query. It's likely to make it into the next milestone of 1.3, i.e., you should have something to try by the end of August. |
DefaultEventPublicationRegistry now tracks the event publications currently in progress, so that the completion step can use the database identifier to issue an update statement solely based on that.
That's in place now. Feel free to give the snapshots a try. |
Hello @odrotbohm,
"java.util.ConcurrentModificationException: null
at java.base/java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1730)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
at org.springframework.modulith.events.core.DefaultEventPublicationRegistry$PublicationsInProgress.getPublication(DefaultEventPublicationRegistry.java:319)
at org.springframework.modulith.events.core.DefaultEventPublicationRegistry$PublicationsInProgress.unregister(DefaultEventPublicationRegistry.java:300)
at org.springframework.modulith.events.core.DefaultEventPublicationRegistry.lambda$markCompleted$3(DefaultEventPublicationRegistry.java:126)
at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196)
at org.springframework.modulith.events.core.DefaultEventPublicationRegistry.markCompleted(DefaultEventPublicationRegistry.java:130)
at jdk.internal.reflect.GeneratedMethodAccessor534.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
at rs.ananas.os.common.configuration.aop.TransactionReadonlyAspect.proceed(TransactionReadonlyAspect.java:34)
at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:637)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:627)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:71)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:173)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720)
at org.springframework.modulith.events.core.DefaultEventPublicationRegistry$$SpringCGLIB$$0.markCompleted(<generated>)
at org.springframework.modulith.events.support.CompletionRegisteringAdvisor$CompletionRegisteringMethodInterceptor.markCompleted(CompletionRegisteringAdvisor.java:224)
at org.springframework.modulith.events.support.CompletionRegisteringAdvisor$CompletionRegisteringMethodInterceptor.invoke(CompletionRegisteringAdvisor.java:193) |
|
#251 pointed at the fact that the database access to mark event publications as completed suffers from the need to query for event payload and publication target identifier. This stems from the fact that the completion is persisted in an interceptor around the target listener, which does not have access to the original event publication's identifier (as it only sees the listener method's argument).
To optimize the data access by using the primary key, we can provide a user-facing SPI that allows extracting an identifier from the actual event payload, defaulting to support jMolecules
Identifiable
/@Identity
out of the box. Uses should be able to declare custom extractors by declaring instances of the interface as Spring bean.The text was updated successfully, but these errors were encountered: