8000 Java DSL throws exception when using `typed.javadsl.EventSourcedBehavior#lastSequenceNumber` · Issue #32433 · akka/akka · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Java DSL throws exception when using typed.javadsl.EventSourcedBehavior#lastSequenceNumber #32433

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

Open
aludwiko opened this issue May 27, 2024 · 4 comments

Comments

@aludwiko
Copy link
Contributor

When handling the first event in the event handler:

java.lang.IllegalStateException: Cannot extract the lastSequenceNumber in state akka.actor.typed.internal.BehaviorImpl$DeferredBehavior$$anon$1
	at akka.persistence.typed.scaladsl.EventSourcedBehavior$.lastSequenceNumber(EventSourcedBehavior.scala:115)
	at akka.persistence.typed.javadsl.EventSourcedBehavior.lastSequenceNumber(EventSourcedBehavior.scala:263)
	at perf.test.iot.DeviceEntity.eventHandler(DeviceEntity.java:82)
	at akka.persistence.typed.javadsl.EventSourcedBehavior.createEventSourcedBehavior(EventSourcedBehavior.scala:224)
	at akka.persistence.typed.javadsl.EventSourcedBehavior.apply(EventSourcedBehavior.scala:207)

I think that pattern matching should also cover Deferred wrapper:
image

@aludwiko aludwiko changed the title Java DSL throws exception when using akka.persistence.typed.javadsl.EventSourcedBehavior#lastSequenceNumber Java DSL throws exception when using typed.javadsl.EventSourcedBehavior#lastSequenceNumber May 27, 2024
@johanandren
Copy link
Contributor

When handling the first event in the event handler

On replay, or after handling a command?

@johanandren
Copy link
Contributor

For the record, Deferred means the behavior was not created yet, it just contains a factory context => behavior, so there is no way to look "inside" it.

Can you share exactly what the event handler method looks like?

@aludwiko
Copy link
Contributor Author

When handling the first event in the event handler

On replay, or after handling a command?

After handling a command.

@leviramsey
Copy link
Contributor
leviramsey commented Jul 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0