if (!_supportedSerializers.TryGetSerializer(acceptContext.ContentType, out serializer))
configurator.SupportMessageSerializer<YourCustomMessageSerializer>();
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/62f1a43b-f498-4401-9b6c-186534dcda53%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
You need to register it on the bus configuration so that it can use the content type for deserialization.configurator.SupportMessageSerializer<YourCustomMessageSerializer>();
On Fri, Jun 7, 2013 at 3:08 PM, Jean Lambert <jeanlamb...@gmail.com> wrote:
Hi,Just wondering if I'm missing something obvious or not here.I'm developing a serializer which acts much like the PreSharedKeyEncryptedMessageSerializer. In essence, it uses a wrapped serialized (JsonMessageSerializer) to do the actual serialization, then performs an encryption transformation and uses the wrapped serializer to serialize the encrypted message.Using MassTransit 2.7.4, there seems to be something new in Endpoint.Receive in which the following line performs a lookup on available serializers:if (!_supportedSerializers.TryGetSerializer(acceptContext.ContentType, out serializer))
The problem I am having is the receiving bus never picks my serializer since it bases its choice on content type.The class SupportedMessageSerializers uses the content type to match a serializer, which in this case is rightfully "application/vnd.masstransit+json"However, my custom serializer does sets the content type correctly but never gets called to deserialize because of the above.At ServiceBus configuration, I do correctly set the default serializer to my custom serializer, but this lookup section in the Endpoint.Receive method considers all serializers and never selects the right one.Any idea what I am doing wrong?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f9b5c1c9-f6d9-4389-b04b-6d4f43b913df%40googlegroups.com?hl=en-US.
EncryptedStream encryptedStream = cryptographyService.Encrypt(readStream);
var encryptedMessage = new EncryptedMessageEnvelope
{
CipheredMessage = Convert.ToBase64String(encryptedStream.GetBytes()),
Iv = Convert.ToBase64String(encryptedStream.Iv),
};
var encryptedContext = new SendContext<EncryptedMessageEnvelope>(encryptedMessage);
encryptedContext.SetUsing(context);
encryptedContext.SetMessageType(typeof (EncryptedMessageEnvelope));
encryptedContext.SetContentType(ContentTypeHeaderValue);
_wrappedSerializer.Serialize(output, encryptedContext);
var bus = ServiceBusFactory.New(sbc =>
{
sbc.SetPurgeOnStartup(true);
sbc.ReceiveFrom("loopback://127.0.0.1/self");
//sbc.SupportMessageSerializer<PreSharedKeyEncryptedMessageSerializer>(); // Causes a compilation error
sbc.SetDefaultSerializer(new PreSharedKeyEncryptedMessageSerializer("eguhidbehumjdemy1234567890123456", new JsonMessageSerializer()));
sbc.Subscribe(s => s.Handler<Message>(m => Console.WriteLine(m.Content)));
});
bus.Publish(new Message { Content = "hello" });
Console.WriteLine("Press key to continue");
Console.ReadKey();
bus.Dispose();
Your serializer should be the one that is setting the content type of the message, so it should be written to the transport as yours.As for overlooking the configuration option to specify the actual serializer instance, I'll see if that can be added.
On Fri, Jun 7, 2013 at 4:09 PM, Jean Lambert <jeanlamb...@gmail.com> wrote:
Hi, that doesn't seem to do the trick since my serializer does not have a parameter-less constructor. Even adding one does not produce the desired behaviour.Lets take for example the PreSharedKeyEncryptedMessageSerializer, it has its own ContentType of "application/vnd.masstransit+psk" but just after its done encrypting in Serialize(), it does the second serialization pass using its wrapped serializer. Say this was an instance of the JsonMessageSerializer, the message ContentType would then be "application/vnd.masstransit+json". On the receiving side, this would be interpreted as a JSON message which would select the JsonMessageSerializer instead of the PreSharedKeyEncryptedMessageSerializer based on the ContentType.
Maybe there is something I'm getting wrong here, but even by registering the ContentType of my custom serializer, since it is two pass, it will always present itself as a ContentType of the wrapped serializer.
On Friday, June 7, 2013 6:58:46 PM UTC-4, Chris Patterson wrote:
You need to register it on the bus configuration so that it can use the content type for deserialization.configurator.SupportMessageSerializer<YourCustomMessageSerializer>();
On Fri, Jun 7, 2013 at 3:08 PM, Jean Lambert <jeanlamb...@gmail.com> wrote:
Hi,Just wondering if I'm missing something obvious or not here.I'm developing a serializer which acts much like the PreSharedKeyEncryptedMessageSerializer. In essence, it uses a wrapped serialized (JsonMessageSerializer) to do the actual serialization, then performs an encryption transformation and uses the wrapped serializer to serialize the encrypted message.Using MassTransit 2.7.4, there seems to be something new in Endpoint.Receive in which the following line performs a lookup on available serializers:if (!_supportedSerializers.TryGetSerializer(acceptContext.ContentType, out serializer))
The problem I am having is the receiving bus never picks my serializer since it bases its choice on content type.The class SupportedMessageSerializers uses the content type to match a serializer, which in this case is rightfully "application/vnd.masstransit+json"However, my custom serializer does sets the content type correctly but never gets called to deserialize because of the above.At ServiceBus configuration, I do correctly set the default serializer to my custom serializer, but this lookup section in the Endpoint.Receive method considers all serializers and never selects the right one.Any idea what I am doing wrong?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/62f1a43b-f498-4401-9b6c-186534dcda53%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/a346aa63-6c1c-4dd4-a60e-5892d7b94a1e%40googlegroups.com?hl=en-US.
MassTransit.Serialization.PreSharedKeyEncryptedMessageSerializer
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f9b5c1c9-f6d9-4389-b04b-6d4f43b913df%40googlegroups.com?hl=en-US.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
context.SetContentType(ContentTypeHeaderValue);
var encryptedContext = new SendContext<EncryptedMessageEnvelope>(encryptedMessage);
encryptedContext.SetUsing(context);
encryptedContext.SetMessageType(typeof (EncryptedMessageEnvelope));
encryptedContext.SetContentType(ContentTypeHeaderValue);
_wrappedSerializer.Serialize(output, encryptedContext);
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/53f25d43-bc9f-458a-9098-74388291aa50%40googlegroups.com.
out serializer) to pick the JSONMessageSerializer instead of the PreSharedKeyEncryptedMessageSerializer. Now, by setting the contentType correctly after the serialization by the wrapped serializer fixes this.
Bob, I'd drop an issue in https://github.com/MassTransit/MassTransit/issues. If you have a failing unit test, all the better.
-Travis
On Wed, Jul 24, 2013 at 8:59 AM, Bob de Ruin <schri...@gmail.com> wrote:
Hello Cris,JeanI have been using the PreSharedKeyEncryptedMessageSerializer as is, using MassTransit 2.7.0. without any problems. After upgrading to version 2.7.4. it stops working. Removing the SetDefaultSerializer(mySerializer) line from the configuration solves the problem, but of course leaves me with unencrypted messages. Reading this thread makes me think it might be releated.@Cris: is this considered a bug? Will it be fixed in the next version? Should I try and assist?@Jean: Did you test your suggested change? And is it working for you now?Regards,Bob.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/d737e9fd-4788-4b2d-9536-7d3f60ede56a%40googlegroups.com.