Skip to content
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

Now supporting arbitrary payload classes #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BernhardBln
Copy link

  • The default payload class is now a clojure map
  • You can pass any other type as well, but in that case, you will have to
    provide your own (de)serializer and the payload-class when invoking
    service-discovery.
  • Clojure maps are converted to Java Hashmaps to get nicer JSON output
  • This breaks compatibility with the previous version where String was
    accepted as payload

* The default payload class is now a clojure map
* You can pass any other type as well, but in that case, you will have to
  provide your own (de)serializer and the payload-class when invoking
  service-discovery.
* Clojure maps are converted to Java Hashmaps to get nicer JSON output
* This breaks compatibility with the previous version where String was
  accepted as payload
@BernhardBln
Copy link
Author

PS: The only draw-back here is that in the serialised hash map, there is an entry "@Class":"java.util.HashMap", which might break java frameworks that expect certain fields there.

Maybe that could be switched off by using a newer version of the fasterxml object mapper and configuring it ourselves (rather than using the JsonInstanceSerializer from Curator), but I'd rather do that in a separate step :)

@BernhardBln
Copy link
Author

I actually dropped the JsonInstanceSerializer in the latest commit, and replaced it by a self-written one using clojure.java.data and clojure.data.json, as the @class attribute caused major problems for us.

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

Successfully merging this pull request may close these issues.

1 participant