Repository navigation
Conversation
Build status (run 45476982876, commit cc66586)JDK 21 - SUCCESS - 33 modules (0 cached, 33 built) in 22:26Per-module details
JDK 25 - SUCCESS - 33 modules (31 cached, 2 built) in 00:25Per-module details
|
ee6e0ab to
9ae39bf
Compare
smcvb
left a comment
There was a problem hiding this comment.
I'd prefer we keep the MessageTransformation interface. I had Laura add that deliberately, as I'd want us to support command and query transformation for rolling upgrade scenarios. The MessageTransformation is the generic form for any message. I am find if we drop the internal method, though, thus changing it into a true marker interface.
| * @author Laura Devriendt | ||
| * @since 5.2.0 | ||
| */ | ||
| public interface MessageTransformation<M extends Message> { |
There was a problem hiding this comment.
This interface exists as a precursor to allow transformation of things other than an EventMessage. Perhaps there's no generic contract yet...but if the transform method specifically is bothering you, we can also only drop that. That would change this into a true marker interface, just as our MessageHandler. However, complete removal of the file doesn't strike me as necessary.
There was a problem hiding this comment.
It can be kept, but it is a bit of misnomer, since Snapshots are Entities not Messages.
There was a problem hiding this comment.
It is back, let me know if the docs on it aren't too verbose.
There was a problem hiding this comment.
It can be kept, but it is a bit of misnomer, since Snapshots are Entities not Messages.
But the snapshots are delivered as SnapshotEventMessage extends GenericEventMessage via the MessageStream returned by the EventStoreTransaction#source(...) operation - so arguably you're transforming a messsage as well probably.
There was a problem hiding this comment.
That's true, but MessageStream is a misnomer as well :) I didn't want to make a snapshot message, but I had no choice as it wouldn't otherwise fit in the source API.
Limiting MessageStream to messages like we did (with a generic bound) means that you can't do a source/query, then transform the result to something you can answer a user request with (you can't feed users messages) -- let's say you need to go all the way to a list of Strings as the answer to a user's query. With MessageStream as it is currently, at some point you're stuck, and have to read the entire stream, and convert it to a java.util.Stream to proceed with whatever you wanted to achieve.
Snapshots are only messages because I had no choice (source delivers a MessageStream that restricts the type to "something that extends message"). Similarly, the ConsistencyMarker isn't simply a record ConsistentyMarker(long position) because that wouldn't fit in a MessageStream, so we make a "special" message for that as well just to make it fit.
The bound that we put on MessageStream is exactly what causes the proliferation of many message subtypes in AF4 that we were trying to avoid in AF5 (and we already have many there already as well).
9ae39bf to
d59f48e
Compare
d59f48e to
d8a821b
Compare
smcvb
left a comment
There was a problem hiding this comment.
I am still on the fence on this change you are doing here, @hjohn.
I know you don't agree with the fact a snapshot can be regarded as a message. That doesn't mean the choice is inherently wrong. Furthermore, reiterating your desires to drop the generic on the MessageStream to abuse it for any kind of object also feels off to me. It's a dedicated solution to streams messages, so defining that you'd expect a Message implementation, what's wrong about that?
Added, you go on to state in the description of this issue, that the MessageStream doesn't support 1-to-1, which is equally false. That is exactly what the MessageStream.Single implementation provides and one of the core principles we wanted a MessageStream to support (0, 1, or N results).
Hence, I do not see why a SnapshotTransformation class couldn't be a MessageTransformation implementation of the SnapshotEventMessage only, ensuring a MessageStream.Single is returned instead.
| * @since 5.2.0 | ||
| */ | ||
| public interface MessageTransformation<M extends Message> { | ||
| public interface MessageTransformation { |
There was a problem hiding this comment.
One of those LLM findings that triggers me too. We're doing breaking changes in public code:
Dropping the
@Internaltransformis fine, that's exactly the freedom the annotation gives us. Dropping the generic is something else though:MessageTransformation<M extends Message>has been public since 5.2.0 (it's in every tag up to 5.4.2), so this is a source-breaking change for anybody that typed against it. I dare to guess nobody is using it other than us, so I'm fine with it. But it should be stated explicitly in the PR description so it lands in the 5.5.0 release notes. (public surface)
| import org.axonframework.messaging.core.MessageStream; | ||
| import org.axonframework.messaging.core.MessageType; | ||
| import org.axonframework.messaging.eventhandling.EventMessage; | ||
|
|
There was a problem hiding this comment.
We should drop the transform mention in the class-level JavaDoc if we go on with this.
| @@ -273,7 +272,7 @@ void producedEventsKeepStreamOrderRelativeToSurroundingEvents() { | |||
| @Test | |||
| void splitEmitsItsReplacementsWhenInvokedDirectly() { | |||
| // SPI contract: a direct transform(...) call yields the ordered replacement events | |||
There was a problem hiding this comment.
More LLM findings this seemingly easy drive-by cause, which may hit users just as well:
"SPI contract" isn't the right wording anymore;
transform(...)is package-private on the variant now, so there's no SPI left to speak of. You dropped the drop-sibling of this test with that exact reasoning. DoessplitEmitsItsReplacementsWhenInvokedDirectlystill earn its place next to the chain tests covering the ordering? If it stays, please reword the comment.
| @@ -57,8 +57,7 @@ final class RenameEventTransformation implements EventTransformation { | |||
| * as a rename consults neither the converter nor the resolver | |||
There was a problem hiding this comment.
I think we can drop the unused TransformationContext parameter now, right? Assuming we stick with the changes being made here.
| @@ -160,19 +159,6 @@ void noPayloadConversionOrIdentityResolutionHappensForDroppedEvents() { | |||
| assertThat(outputs).isEmpty(); | |||
| } | |||
|
|
|||
d8a821b to
60fed2a
Compare
60fed2a to
cc66586
Compare
|
Although strictly an enhancement, marked as a bug since this functionality is currently blocking users migrating their snapshots from AF4 into AF5. |
smcvb
left a comment
There was a problem hiding this comment.
Checking this PR again, after having reviewed #815 twice, I strongly doubt why we need this adjustment. Frankly, I am leaning towards closing this PR with the label won't fix.
It just introduces an unnecessary breaking change, which I only assume is pulled in because you disagree with the scope of the MessageStream.Entry to contain implementations of a Message only. I think I've already clarified that now is not the time to adjust AF5 APIs like that any further, so we can take that concern once we tackle AF6.
We could limit the scope to just removing the two As it is, we don't need this to be in for snapshot transformations, so I'm fine with either. |
EventTransformationhad two operations on it,matcher()and an inheritedtransform(...), both marked@Internal. Neither was ever dispatched polymorphically: everywhere the chain did something with a transformation it first switched on the concrete type, and only then called through the interface. Because they sat on the interface they had to be public, which is how framework-only operations ended up on a type users hold. Both are now package-private on the variants and called directly after the switch, with a smallmatcherOf(...)helper inTransformationIndexfor the few sites that had not already narrowed.EventTransformationcarries no members at all, declared or inherited.The usual objection to trading polymorphism for a switch is that adding a variant means touching every call site. That cost does not apply here: the four variants are package-private, so nobody outside the module could add a fifth, and because the hierarchy is sealed, adding one later is a compile error at each switch rather than a silent gap.
DropEventTransformation.transformexisted only to satisfy the interface and was never invoked, since the chain short-circuits drops before reaching it, so it is gone, together with the test asserting that direct-call contract. No behaviour changed.MessageTransformationstays, as a marker interface for the transformations of each kind of message: it losestransform(...)and its type parameter.Breaking change (5.5.0 release notes):
MessageTransformation<M extends Message>, public since 5.2.0, no longer has a type parameter, so code referring toMessageTransformation<...>no longer compiles.This PR should be back ported to
axoniq-5.4.xonce approved and merged.