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
[Feature] Allow Custom Serializer for jobs #234
Comments
This was done on purpose as there are specific requirements for the client. Providing a custom serializer increases the risk to break the dashboard a lot. |
Would it be worth exposing an Another option could be separating custom serialization rules provided by the application from serialization used by the the framework. I have no idea how much work that is though, I'm guessing a lot. I suppose for now the workaround is to manually serialize your arguments with the application's preferred method, and pass in a string payload to be deserialized on the other side when the job runs. |
Will be resolved in JobRunr 4.0.1 where you have full control over the JsonMapper. |
Yay! Thank you! |
Hey @rdehuyss. I wonder if it was in fact resolved in v4.0.1. I'm using v6.1.3 (the latest) and I still experience the issue as @maxwellclarke-wf described. If it was in fact resolved, how do we set a |
Hi @cebbens - how are you using JobRunr? Standalone, with Spring, ... ? |
What about the |
Hi @cebbens - did you try the ObjectMapper objectMapper = new ObjectMapper(); // your configuration can happen here
JobRunr.configure()
.useJsonMapper(new JacksonJsonMapper(objectMapper))
.useJobActivator(jobActivator)
.useStorageProvider(storageProvider)
.useBackgroundJobServer(usingStandardBackgroundJobServerConfiguration().andPollIntervalInSeconds(5))
.initialize(); |
Hi @rdehuyss Yes, we initially had that config and thought that it was there for precisely re-using our own We had some other problems at the same time, so maybe the I'll try it again whenever I find the time and let you know how it went, thanks! |
Are you running the latest version of JobRunr?
Yes
Describe the bug
There is no way to configure and pass in a custom json mapper instance from
JobRunr.configure()
.JobRunr.configure()
always creates aJobMapper
with its ownJsonMapper
. When supplying a custom-builtStorageProvider
, JobRunr always overwrites theJobMapper
in theStorageProvider
with its own defaultJobMapper
instance with no way to override. This pattern continues down to the ObjectMapper supplied by JacksonJsonMapper, resulting in a mapper with no way to inject custom serialization/deserialization logic as a custom jacksonObjectMapper
or register aModule
.Environment
I'm using JobRunr version: v4.0.0
I'm running on JRE / JDK (e.g. OpenJDK 1.8.0_292): OpenJDK 1.11
I'm using the following StorageProvider (e.g. Oracle / MongoDB / ...): MySQL/MariaDB
How to Reproduce
Provide a simple Github project or code fragment which shows how to reproduce the issue (ideally a Github repo).
Apologies it's in Kotlin:
Expected behavior
An option to override or augment default mapping behavior
Additional context
There could be a way to do this in Spring (I haven't crawled through the config yet), but I'm using this option right now because the repository I'm working in didn't register any beans.
The text was updated successfully, but these errors were encountered: