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

Beta8: Serialization type #255

Closed
msnelling opened this issue Aug 14, 2017 · 6 comments
Closed

Beta8: Serialization type #255

msnelling opened this issue Aug 14, 2017 · 6 comments

Comments

@msnelling
Copy link
Contributor

Hi,
I'm looking at porting our app to use RawRabbit 2.0. Beta 8 defines the ISerializer interface as

  public interface ISerializer
  {
    string ContentType { get; }
    string Serialize(object obj);
    object Deserialize(Type type, string str);
    TType Deserialize<TType>(string str);
  }

How will this work if say my messages are to be serialised as binary protocol buffer messages when the Serialize() function returns a string instead of byte[]?

@pardahlman
Copy link
Owner

Hello @msnelling - thanks for reporting this.

I believe that you are right, the ISerializer assumes that you serialize to string based output (like json, xml ...). At a first glance in the code, it shouldn't be that big of an effort to update the signature, but I have to look closer at it before committing to this change.

In the mean while, it shouldn't be that difficult working around this, as the client is can easily be modified. The bytes of a published message is extracted from the serialized message (string), and it is possible to update/replace that middleware by using the fluent builder in the Plugin property of RawRabbitOptions.

@msnelling
Copy link
Contributor Author

Thanks.
I'm having trouble with the Plugin syntax, are there any examples?

@pardahlman
Copy link
Owner

You can have a look at the Enrichers in the 2.0 branch. There is unfortunately no better documentation at this point.

pardahlman added a commit that referenced this issue Aug 19, 2017
So that it works with byte arrays. The JsonSerializer
is kept almost intact thanks to the new base class for
string based serialization
pardahlman added a commit that referenced this issue Aug 19, 2017
pardahlman added a commit that referenced this issue Aug 19, 2017
So that if there is a mismatch in serializer between clients
they will post to error exchange or propegate back to requester
@pardahlman
Copy link
Owner

Hello again. I've updated the ISerializer interface so that it works with byte arrays. To verify that it works, I've also created an enricher that changes serializer to protobuf 👉 https://github.com/pardahlman/RawRabbit/blob/2.0/test/RawRabbit.IntegrationTests/Enrichers/ProtobufTests.cs

This will be part of beta9.

@msnelling
Copy link
Contributor Author

Thanks!

@pardahlman
Copy link
Owner

pardahlman commented Sep 8, 2017

Released

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

2 participants