-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Cannot deserialize TopicPartition from JobRepository #3797
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
Comments
same question |
same question too |
Jackson2ExecutionContextStringSerializer always forces all map keys to be String. Instead, I think we can store only the partition number (as a String) in update(),nd then reconstruct the full TopicPartition in open() by using the topic name provided to the constructor. For example:
|
baezzys
pushed a commit
to baezzys/spring-batch
that referenced
this issue
Jun 3, 2025
- Convert TopicPartition keys to String format (topic-partition) when saving to ExecutionContext - Support both String and TopicPartition keys when restoring from ExecutionContext - Prevent ClassCastException when using JobRepository with Jackson serialization Resolves spring-projects#3797
baezzys
pushed a commit
to baezzys/spring-batch
that referenced
this issue
Jun 3, 2025
…tory (spring-projects#3797) - Replace Map<TopicPartition, Long> with List<Map<String, Object>> for offset storage - Ensure compatibility with Jackson serialization used by JobRepository - Add tests to verify proper serialization/deserialization of execution context - Maintain backward compatibility while fixing ClassCastException on job restart Resolves spring-projects#3797
Could I work on this issue? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi.
I use MySQL for JobRepository. It serialize ExecutionContext as String by JacksonObjectMapper.
It seems to forcing to
Map
's key type must beString
. (Map<String, Object>
)You can see this.
For Example,
SHORT_CONTEXT
inBATCH_STEP_EXECUTION_CONTEXT
:However,
KafkaItemReader
usesTopicPartition
as key. So It has problem in deserializingExecutionContext
. You can see this.I think It should be deserialize by String first.
And then, convert
String
toTopicPartition
inKafkaItemReader
.Like this,
The text was updated successfully, but these errors were encountered: