Skip to content
This repository was archived by the owner on Dec 7, 2018. It is now read-only.

[#45] Describe the three different Serializers in Advanced Tuning section#60

Merged
smcvb merged 6 commits into3.1from
enhancement/45
Jul 17, 2018
Merged

[#45] Describe the three different Serializers in Advanced Tuning section#60
smcvb merged 6 commits into3.1from
enhancement/45

Conversation

@smcvb
Copy link
Member

@smcvb smcvb commented Jul 11, 2018

This PR adds a more concise description on what Serializer implementations there are and how these are configured correctly. Additionally, the section is referred to from several location to add clarity.

Resolve #45

smcvb added 4 commits July 11, 2018 15:23
Introduce Serializers topic in the Advanced Customizations section,
giving a break down of the possible serializers, configurable levels and
 a code example

#45
Refer to Serializer section and add messageSerializer Spring example

#45
Be a bit more specific on serializer in the Saga section

#45
Refer to Serializer section

#45
@smcvb smcvb added this to the Release 3.1 milestone Jul 11, 2018
@smcvb smcvb self-assigned this Jul 11, 2018
@smcvb smcvb requested review from abuijze and m1l4n54v1c July 11, 2018 18:38
Copy link
Member

@abuijze abuijze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed some minor changes.

Copy link
Member

@m1l4n54v1c m1l4n54v1c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor grammar thing.
One suggestion.

```

When overriding both the default serializer and defining an event serializer, we must instruct Spring that the default serializer is, well, the default:
Equal to events, you can also customize the Message `Serializer` used by your application. The Message `Serializer` comes into play when your Command and Query message are send from one node to another in a distributed environment. To set a custom `Serializer` for you message you can simply define a `messageSerializer` bean like so:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Query messages are sent from one ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharp, fixed typo.

3. The Default `Serializer` is in charge of de-/serializing the remainder, being the Tokens, Snapshots and Sagas. These objects are generally not shared between different applications, and most of these classes aren't expected to have some of the getters and setters that are, for example, typically required by Jackson based serializers. A flexible, general purpose serializer like [XStream](http://x-stream.github.io/) is quite suited for this purpose.

By default all three `Serializer` flavors are set to use the `XStreamSerializer`, which internally uses [XStream](http://x-stream.github.io/) to serialize objects to an XML format. XML is a verbose format to serialize to, but XStream has the major benefit of being able to serialize virtually anything. This verbosity is typically fine when storing tokens, sagas or snapshots, but for messages (and specifically events) XML might prove to cost too much due to its serialized size. Thus for optimization reasons you can configure different serializers for your messages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: I would mention interoperability reasons here also. If some other systems (not necessarily written in Java) wants to read the events, some other format is preferred here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair suggestion which is good to take into account. Will make the necessary adjustment.

Fix typo and add suggestion

#45
@smcvb smcvb merged commit f7d0e09 into 3.1 Jul 17, 2018
@smcvb smcvb deleted the enhancement/45 branch July 17, 2018 12:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants